Skip to content

Instantly share code, notes, and snippets.

View tk120404's full-sized avatar
🎯
Focusing

Arjunkumar tk120404

🎯
Focusing
View GitHub Profile
@matiasfha
matiasfha / index.html
Created June 10, 2011 15:14
node.js + socket.io + thrift
<img src="/videoStream" id="video"/>
<script src="socket.io/socket.io.js"></script>
<script>
var socket = new io.Socket(null,{port:8080});
socket.connect();
socket.on('connect',function(){
document.getElementById('mensajes').innerHTML = "conectado";
})

These instructions work for the Raspberry Pi running Raspbian (hard float) and create a hardware optimized version of NodeJS for the Raspberry PI, (and include a working install and NPM!!!):

  1. Install Raspbian - http://www.raspberrypi.org/downloads

  2. Install the necessary dependecies:

sudo apt-get install git-core build-essential

(If you just installed git then you need to administer your git identity first, else adding the patches below will fail!!!)

@max-mapper
max-mapper / index.js
Created September 26, 2012 04:30
html5 audio capture
// get latest canary and turn on web audio in chrome://flags
navigator.webkitGetUserMedia({audio:true}, function (stream) {
var context = new webkitAudioContext()
var streamSource = context.createMediaStreamSource(stream)
var sent = false
bufferFiller = context.createJavaScriptNode(2048, 1, 1)
bufferFiller.onaudioprocess = function(e) {
if (sent) return
@domenic
domenic / promises.md
Last active June 24, 2024 03:11
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@paulirish
paulirish / gist:4158604
Created November 28, 2012 02:08
Learn JavaScript concepts with recent DevTools features

Learn JavaScript concepts with the Chrome DevTools

Authored by Peter Rybin , Chrome DevTools team

In this short guide we'll review some new Chrome DevTools features for "function scope" and "internal properties" by exploring some base JavaScript language concepts.

Closures

Let's start with closures – one of the most famous things in JS. A closure is a function, that uses variables from outside. See an example:

@tk120404
tk120404 / india.js
Last active October 4, 2016 13:23
Prints India Map as shown below in the india.txt node india.js
var a,b=0,c=10,qwer ="TFy!QJu ROo TNn(ROo)SLq SLq ULo+UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^NBELPeHBFHT}TnALVlBLOFAkHFOuFETpHCStHAUFAgcEAelclcn^r^r\\tZvYxXyT|S~Pn SPm SOn TNn ULo0ULo#ULo-WHq!WFs XDt!";
while ((a = qwer.charCodeAt(b++)) != 0) {
while (a-- > 64) {
require('sys').print( ++c==90 ? String.fromCharCode(c = c/ 9):String.fromCharCode(33^b&1));
}
}
//Source : http://codepad.org/ngiITeZ4
@CMCDragonkai
CMCDragonkai / angularjs_directive_attribute_explanation.md
Last active November 29, 2023 15:35
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@demisx
demisx / angularjs-providers-explained.md
Last active May 17, 2024 03:38
AngularJS Providers: Constant/Value/Service/Factory/Decorator/Provider
Provider Singleton Instantiable Configurable
Constant Yes No No
Value Yes No No
Service Yes No No
Factory Yes Yes No
Decorator Yes No? No
Provider Yes Yes Yes

Constant

@staltz
staltz / introrx.md
Last active July 19, 2024 22:21
The introduction to Reactive Programming you've been missing
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script type="text/javascript" charset="utf-8" src="http://cdn.clappr.io/j/vendor/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="http://cdn.clappr.io/j/vendor/underscore-min.js"></script>
<script type="text/javascript" charset="utf-8" src="http://cdn.clappr.io/latest/clappr.min.js"></script>
<script type="text/javascript" charset="utf-8" src="http://cdn.clappr.io/bemtv/alpha/p2phls.min.js"></script>
<script type="text/javascript" charset="utf-8" src="http://cdn.clappr.io/bemtv/latest/p2phlsstats.min.js"></script>
<title>Globo Media Control Test Page</title>