Skip to content

Instantly share code, notes, and snippets.

@almost
almost / proposal.md
Last active September 12, 2019 09:07
Reactive 2016 Lightning Talk Proposal: Get Flow

This is a proposal for a lightning talk at the Reactive 2016 conference.

NOTE: If you like this, star ⭐ the Gist - the amount of stars decides whether it makes the cut! You could also Retweet if you want :)

Get Flow

Type checking JavaScript with Flow

JavaScript is a dynamic language, and there's nothing wrong with that. It allows quick iteration and lowers barriers. However, sometimes some compile-time type checking is just what you need to keep your code in line and give yourself the confidence to build bigger and faster. Flow gives the best of both worlds. You can have normal JavaScript but you can also add types where they're helpful, and it adds zero cost at runtime. In this talk I'll show Flow as it applies to a Redux & React codebase.

h('div.container', [
h('label.nameLabel', 'Name:'),
h('input.myinput', {attributes: {type: 'text'}}),
h('hr'),
h('h1.greeting', `Hello ${name}`)
])
// or
div('.container', [
@derMani
derMani / GridStream.js
Last active September 5, 2020 19:07 — forked from psi-4ward/GridStream.js
NodeJS MongoDB-GridFS Video range stream exampleLets your browser seek/jump wihin the video-playback.
var express = require('express');
var app = express();
var mongo = require('mongodb');
var MongoClient = require('mongodb').MongoClient;
var GridStore = mongo.GridStore;
var ObjectID = require('mongodb').ObjectID;
function StreamGridFile(req, res, GridFile) {
@lastguest
lastguest / JSON_to_URLEncoded.js
Created July 10, 2014 17:47
Convert JavaScript object to x-www-form-urlencoded format
function JSON_to_URLEncoded(element,key,list){
var list = list || [];
if(typeof(element)=='object'){
for (var idx in element)
JSON_to_URLEncoded(element[idx],key?key+'['+idx+']':idx,list);
} else {
list.push(key+'='+encodeURIComponent(element));
}
return list.join('&');
}
@staltz
staltz / introrx.md
Last active April 18, 2024 05:34
The introduction to Reactive Programming you've been missing
@desandro
desandro / transition-scroll-to.js
Created December 4, 2012 16:50
Use CSS transitions to scroll to element
( function( window, undefined ) {
'use strict';
// helper function
function capitalize( str ) {
return str.charAt(0).toUpperCase() + str.slice(1);
}
// ========================= getStyleProperty by kangax ===============================