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 five = require("johnny-five"), | |
// or "./lib/johnny-five" when running from the source | |
board = new five.Board(); | |
board.on("ready", function() { | |
// Create an Led on pin 13 and strobe it on/off | |
// Optionally set the speed; defaults to 100ms | |
(new five.Led(13)).strobe(); |
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 five = require("johnny-five"), | |
twitter = require('ntwitter'), | |
board, lcd, mentions = 0; | |
board = new five.Board(); | |
board.on("ready", function() { | |
lcd = new five.LCD({ | |
pins: [ 8, 9, 10, 11, 12, 13 ], |
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 PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
<html> | |
<head> | |
<title>CORS for static resources</title> | |
</head> | |
<body> | |
<img src="http://slides.varunkumar.me/static/images/may2012.jpg" crossorigin=""> | |
<!-- www.varunkumar.me doesn't set CORS headers --> | |
<!--script src="http://www.varunkumar.me/static/js/calculator.js"></script> |
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
gsub = function(source, pattern, replacement) { | |
var match, result; | |
if (!((pattern != null) && (replacement != null))) { | |
return source; | |
} | |
result = ''; | |
while (source.length > 0) { | |
if ((match = source.match(pattern))) { | |
result += source.slice(0, match.index); | |
result += (typeof replacement === 'function') ? replacement(match[0]) : replacement; |
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
<html style="width:100%; height:100%; overflow:hidden"> | |
<body style="width:100%; height:100%; overflow:hidden; margin:0"> | |
<script> | |
function main() { | |
if (WS.scriptVersion(1)) return; | |
WS.displayWarpView([3.0439236881258753, -0.09811170052611454, -1351.6367347302782, 0.03321587552236447, 3.053154626691264, -40.341560801335376, -0.00010172584427831437, -5.8759263127489935e-05, 1.0]); | |
WS.cameraOn(.1, 360, 640); | |
} | |
window.onload = main; | |
</script> |
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 lastName = ''; | |
// some code here | |
// at later point | |
lastNam = 'Nagarajan'; // value will be assigned to window.lastNam | |
alert(lastName); | |
alert(window.lastNam); |
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
"use strict"; // strict mode JS | |
// IIFE | |
(function () { | |
const Person = (function () { | |
// private static | |
var nextId = 1; | |
// constructor | |
var person = function () { | |
// private members |
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
#!/bin/bash | |
# Script for cleaning up node_modules and other tmp files (like core) | |
# Usage: ./cleanup-space.sh -m +15 | |
# This will cleanup node modules not accessed in the last 15 days | |
VERSION=0.1.0 | |
# Defaults | |
CLEANUP_TIME=+15 |