Skip to content

Instantly share code, notes, and snippets.

View netroy's full-sized avatar

कारतोफ्फेलस्क्रिप्ट™ netroy

View GitHub Profile
@netroy
netroy / ws.js
Created June 17, 2014 01:18
Incercepting XHR & WebSockets
var proto = WebSocket.prototype;
var send = proto.send;
Object.defineProperty(proto, 'send', {
'writable': false,
'value': function (data) {
console.log(data);
return send.apply(this, arguments);
}
});
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-menu/core-submenu.html">
@netroy
netroy / sub.go
Last active January 11, 2019 21:57
Redis subscribe over websockets in golang
package main
import (
"github.com/chuckpreslar/emission"
"github.com/garyburd/redigo/redis"
"github.com/gorilla/websocket"
"log"
"net/http"
)
@netroy
netroy / 140bytes.js
Last active August 29, 2015 14:01 — forked from ebidel/highlight_custom_elements.js
highlight all custom elements in dom
[].forEach.call(document.all,function(e){-1!==e.constructor.name.indexOf("-")&&(e.style.border="3px solid red")});
@netroy
netroy / http.go
Last active August 29, 2015 14:00
martini + spdy + gzip
package main
import (
"log"
"net/http"
"github.com/SlyMarbo/spdy"
"io"
"compress/gzip"
"strings"
)
@netroy
netroy / keybase.md
Created March 25, 2014 22:05
keybase.md

Keybase proof

I hereby claim:

  • I am netroy on github.
  • I am netroy (https://keybase.io/netroy) on keybase.
  • I have a public key whose fingerprint is AD34 72D7 4827 4AE4 8A56 CA53 ED26 745F 4605 EF41

To claim this, I am signing this object:

@netroy
netroy / rethinkdb-clustering.md
Created March 16, 2014 14:57
RethinkDB clustering with docker

Get my rethinkdb base image

docker pull netroy/rethinkdb

Start master

docker run -P -d rethinkdb

Start others

docker run -P -d rethinkdb [IP OF THE MASTER]

@netroy
netroy / disabled-console.js
Last active August 29, 2015 13:56
Dat FB console ... for academic purposes only
(function (window) {
'use strict';
var realConsole = window.console || {};
var warnings = {
'Sorry, Your console is disabled for security reasons.': 'color: red; font-size: 36px; line-height: 40px;'
};
@netroy
netroy / pre-commit
Created September 24, 2013 09:02
JSHint precommit hook
#!/bin/sh
files=$(git diff --cached --name-only --diff-filter=ACM | grep ".js$")
if [ "$files" = "" ]; then
exit 0
fi
pass=true
for file in ${files}; do
@netroy
netroy / primes.js
Created September 16, 2013 21:24 — forked from rakeshpai/primes.js
var primes = [2];
var n = 3; // The number we are testing. Will be incremented.
function checkNextNumber() {
// It's sufficient to check if there are any prime factors up to sqrt(n)
n++;
var limitForChecking = Math.floor(Math.sqrt(n));