Skip to content

Instantly share code, notes, and snippets.

View rakeshpai's full-sized avatar

Rakesh Pai rakeshpai

View GitHub Profile
@rakeshpai
rakeshpai / index.html
Created February 20, 2013 12:29
Opera .stack / .stacktrace madness
<!doctype html>
<title>Stackgen</title>
<script src="stackgen.js"></script>
<script>
try {
stackgen();
} catch(e) {
ex = e;
throw e;
@rakeshpai
rakeshpai / primes.js
Last active December 22, 2015 21:29
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));
@rakeshpai
rakeshpai / gulpfile.js
Last active October 13, 2015 15:12
Browserify + Uglify + Espruino using Gulp
var gulp = require("gulp"),
browserify = require("browserify"),
source = require("vinyl-source-stream"),
buffer = require("vinyl-buffer"),
uglify = require("gulp-uglify"),
through = require("through2"),
port = "/dev/cu.wchusbserial410",
espruino = require("node-espruino").espruino({comPort: port});
@rakeshpai
rakeshpai / bitflipper.js
Created July 9, 2016 07:55
Code to randomly turn on or off an LED. With an extremely useful HTTP API. Uses Espruino, running on an ESP8266 (ESP-03).
var wifi = require("Wifi"),
ledPin = D14,
buttonPin = D0,
ssid = "...",
password = "...";
var led = (function() {
var pulseIntervalHandle,