Skip to content

Instantly share code, notes, and snippets.

Avatar

Artur arturz

View GitHub Profile
@diachedelic
diachedelic / deep-link-from-browser.js
Last active Sep 21, 2020
Deep link to a native app from a browser, with a fallback
View deep-link-from-browser.js
@staltz
staltz / introrx.md
Last active Sep 25, 2020
The introduction to Reactive Programming you've been missing
View introrx.md
@samgiles
samgiles / flatMap.js
Created Jun 20, 2014
Javascript flatMap implementation
View flatMap.js
// [B](f: (A) ⇒ [B]): [B] ; Although the types in the arrays aren't strict (:
Array.prototype.flatMap = function(lambda) {
return Array.prototype.concat.apply([], this.map(lambda));
};
@tedmiston
tedmiston / nodejs-tcp-example.js
Last active Sep 23, 2020
Node.js TCP client and server example
View nodejs-tcp-example.js
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');
@crtr0
crtr0 / client.js
Created Jun 8, 2012
A simple example of setting-up dynamic "rooms" for socket.io clients to join
View client.js
// set-up a connection between the client and the server
var socket = io.connect();
// let's assume that the client page, once rendered, knows what room it wants to join
var room = "abc123";
socket.on('connect', function() {
// Connected, let's sign-up for to receive messages for this room
socket.emit('room', room);
});
View html5-video-streamer.js
/*
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js
*/
var http = require('http'),
fs = require('fs'),
util = require('util');
http.createServer(function (req, res) {
var path = 'video.mp4';
You can’t perform that action at this time.