This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require("http"); | |
function inf(i) { | |
var req = http.request({ | |
method: "GET", | |
path: "/", | |
host: "www.google.com", | |
port: 80 | |
},function() { | |
console.log(i,"Response received"); | |
inf(i+1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var B = require("bluebird/js/main/promise")(); | |
var Bproto = B.prototype; | |
var deferredPrototype = B.pending().constructor.prototype; | |
deferredPrototype.makeNodeResolver = function() { | |
return this.asCallback; | |
}; | |
function bind(fn, ctx) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<div class="inverter"> | |
</div> | |
<script id="jsbin-javascript"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.CACHE_NAME = ["cats-v", 14]; | |
var cache_name = self.CACHE_NAME[0] + self.CACHE_NAME[1]; | |
self.addEventListener('fetch', function(event) { | |
var cacheRequest = event.request.clone(); | |
event.respondWith(caches.match(cacheRequest).then(function(response) { | |
if(response) return response; | |
var fetchRequest = event.request.clone(); | |
return fetch(fetchRequest).then(function(response) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install pathogen | |
cd | |
git clone git@github.com:tpope/vim-pathogen .vim | |
mkdir .vim/bundle | |
cd .vim/bundle | |
# Install SuperTab | |
git clone git@github.com:ervandew/supertab | |
# Install Syntastic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// require() some stuff from npm (like you were using browserify) | |
// and then hit Run Code to run it on the right | |
var Model = require('ampersand-state'); | |
var Collection = require('ampersand-collection'); | |
var Item = Model.extend({ | |
props: { | |
name: 'string' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var State = require('ampersand-state'); | |
var Person = State.extend({ | |
props: { | |
firstName: 'string', | |
lastName: 'string' | |
}, | |
derived: { | |
cachedFullName: { | |
deps: ['firstName', 'lastName'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// lo-dash lib is the dependency | |
function readOnly(target){ | |
var _readOnly = function (target, acc) { | |
// acc is passed into the function to be used for observer | |
var _defineProperty = function (propName, target, acc) { | |
var i, len; | |
// operation to be performed when add occurred |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.prototype.addEvent = function(evt, handler, useCapt) { | |
//JUST A CHECK TO HANDLE “onclick” and “click” as evt | |
if(evt.match(“^on”)) | |
evt = evt.substr(2); | |
if(this.attachEvent) | |
return this.attachEvent('on' + evt, handler); // FOR IE | |
else if(this.addEventListener) | |
return this.addEventListener(evt, handler, useCapt); // OTHERS | |
else { | |
//IF BOTH FAILS |
OlderNewer