Skip to content

Instantly share code, notes, and snippets.

View boopathi's full-sized avatar
💭
I may be slow to respond.

Boopathi Rajaa boopathi

💭
I may be slow to respond.
View GitHub Profile
@boopathi
boopathi / infinite.js
Created February 18, 2014 10:50
A bug with node.js HTTP. Cannot send more than 5 HTTP requests with Node.
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);
@boopathi
boopathi / deploy.php
Last active August 29, 2015 14:05
Github webhook deploy php
<?php
class Deploy {
//
// EDIT ME
// This will be sent as the User Agent to the Meta API. Set this as
// your GITHUB_USERNAME or APPLICATION_NAME
// Documentation: https://developer.github.com/v3/#user-agent-required
//
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) {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<div class="inverter">
</div>
<script id="jsbin-javascript">
@boopathi
boopathi / sw.js
Last active August 29, 2015 14:13
sw.js
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) {
@boopathi
boopathi / vim_settings.sh
Created January 22, 2015 23:07
My Vim settings
# 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
@boopathi
boopathi / index.js
Last active August 29, 2015 14:19
requirebin sketch
// 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'
}
@boopathi
boopathi / index.js
Last active August 29, 2015 14:22
requirebin sketch
var State = require('ampersand-state');
var Person = State.extend({
props: {
firstName: 'string',
lastName: 'string'
},
derived: {
cachedFullName: {
deps: ['firstName', 'lastName'],
@boopathi
boopathi / README.md
Last active August 29, 2015 14:27
Differentiate between an arrow function, class, method, generator and a normal function in ES6
@boopathi
boopathi / gist:57e0e63976d27e969f9c
Last active September 6, 2015 16:46 — forked from bolshchikov/gist:8069009
Creating read-only JS object
// 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