Categories
Tech Industry

Queens JS (4 Apr 2020)

A photograph on the backdrop of coronavirus panick throughout the city.

Angus Grieve-Smith (@grvsmth) treated us to a display of how to audio interfaces using native web controls, appropriately titled “Web Audio With Javascript” Their website is grieve-smith.com

Angus shows how to use native Javascript to build an audio recorder.

Peter Karp talked about Pydantic, a python validation tool. He compared it to marshmallow, a tool he says is outdated and was used for serialization, validation, and typing in JSON manipulation.

Peter Karp talks Pydantic

And finally, Tracy Hinds (@HackyGoLucky) talked about conflict resolution on software development teams.

Categories
Tech Industry

Brooklyn JS #75 (13 Jan 2020)

Thomas Bery told us about his project to build jambuds.club, a social listening platform he has been working on as passion project.

Fil Zembowicz, who says he runs a company called FormSort, gave a talk called “Grappling with Higher Powers”. @fzembow on twitter.

Jessie Wu talked to us about building automated phone systems using Amazon connect with Amazon Lex. She pulled of a successful live demo of Hotling bling.

Travis Fisher then gave us some opinions about open source.

Finally, Tom Luttg finished off the evening with a talk called “Keeping Neural Networks Weird”


The musical guest for the evening was Jake from Baby Got Backtalk

TODO: look up saasify.sh

Categories
Programming

Prettify your ‘Alert’ box in Javascript

Really nice replacement for Javascript’s ‘alert’ dialog box.

Check out the website: http://tristanedwards.me/sweetalert

 

Categories
Programming

CanIUse.com: Resource for Cutting Edge CSS/JavaScript Developers

Here’s a great resources for CSS & JavaScript developers who want to be on the bleeding edge of CSS3 and HTML. Interactive visualizations show you browser support for various parts of the language you want to try out.

http://caniuse.com

Categories
Programming

Warning: Adding Active Model Serializer will Change the Behavior of to_json

If you haven’t worked with JSON endpoints and/or Active Model Serializer much there’s some specific nuances to keep in mind when adding rails-api/active_model_serializers to your project.

In the old days, our JSON output typically looked like this:

[
 { “title”: “Post 1”, “body”: “Hello!” },
 { “title”: “Post 2”, “body”: “Goodbye!” }
]

You will note this is an array of “posts,” but you don’t explicitly know it is an array of posts because it just looks like a Javascript object (hence Javascript object notation, or JSON)

These days, it is more common to include what we call the “root element” in the json output. This is required on some more modern front-end frameworks, like Ember, and there are several reasons why including the root element is a good idea. (In Ember, in particular, you can side-load data along with the root element which is more efficient. Read more about side-loading ember data)

So a JSON endpoint that responds with the root element might look like this:

{
 “posts”:
  [
   { “title”: “Post 1”, “body”: “Hello!” },
   { “title”: “Post 2”, “body”: “Goodbye!” }
  ]
}

In an older Rails app (Rails 3 or prior), if you aren’t using Active Model serializer you are probably calling to_json yourself. (You are calling it implicitly if you do render json: @something in a controller.). The default behavior is to not include the root in your JSON output. (You can modify this globally with the ActiveRecord::Base.include_root_in_json, or other ways on a per-model basis).

This is a relatively long blog post to explain & document something simple, but important, that happens when you go to add the active_model_serializers gem to a project that doesn’t already have it: The default behavior of to_json – even when you aren’t explicitly using an ActiveModel::Serializer – is changed to include the root

If you read the section about including the root in the output of the ActiveModel Serializer., you’ll see much discussion about how to disable the default behavior. What it doesn’t say is that just adding the gem changes the default behavior of Rails 3, so if you have legacy code serializing JSON output, adding the gem will unintentionally change the behavior of your endpoints.

Categories
Programming

Setting up Javascript Lint with TextMate

cd ~/Library/Application Support/TextMate/Bundles

git clone git://github.com/subtleGradient/javascript-tools.tmbundle.git

In Textmate, Bundles > Bundle Editor > Reload bundles

Now open a Javascript file and to Control-Shift V and choose “JSLint”

Also install Node.js
https://github.com/joyent/node/wiki/Installation

(Mac user can install using this package: https://sites.google.com/site/nodejsmacosx/)