Skip to content

Instantly share code, notes, and snippets.

sas2flash.efi -l log.txt -debug -o -f 2118IT.BIN -b MPTSAS2.ROM
Advanced Mode Set
Adapter Selected is a LSI SAS: SAS2008(B2)
Chip status 0000000000000000:
Executing Operation: Flash Firmware Image
module.exports = function () {
console.log(this === global);
}
var addNumber=function(x){
//first class function : a function treated as an object
return function(y){
//x is a free variable. (i.e. not a local variable or an argument of this function.)
//x is bound to the argument x in lexical environment defined by the addNumber function
return x+y;
};
};
SerialPort = require('serialport').SerialPort
@jgautier
jgautier / __proto__.js
Created March 9, 2011 06:04
Settign the .prototype property
//create object with function
var Foo=function(){
};
//set the bar method on the prototype
Foo.prototype={
bar:function(){
console.log("bar");
}
};
var foo=new Foo();
@jgautier
jgautier / apply.js
Created May 23, 2011 03:59
Javascript Scoping
function Button(text){
this.text = text;
}
Button.prototype.onClick=function(callback){
//set fake x,y coordinates
var x=0,y=0;
callback.apply(this,[x,y]);
};
var button = new Button('The Button');
button.onClick(function(x,y){
@jgautier
jgautier / let.js
Created May 24, 2011 04:55
sample code for let
function letX(){
var x = 0;
if(true){
let x = 1;
//1
console.log(x);
}
//0
console.log(x);
}
@jgautier
jgautier / node-firmata-attempt.js
Created July 6, 2011 23:14 — forked from karlwestin/node-firmata-attempt.js
My short node-js-firmata attempt
// On Arduino Uno 2.2
// Using Examples > Firmata > StandardFirmata_2_2_forUNO_0_3
var firmata = require("./firmata/lib/firmata");
var board = new firmata.Board("/dev/tty.usbmodem621",function(){
//code for board needs to go here
console.log(board); // logs board object, board.pins is empty
board.digitalWrite(2, 1); // generates error can't write value to undefined
});
@jgautier
jgautier / gist:1235611
Created September 22, 2011 18:39
Deferred Creation
var deferredTask = function(){
var dfd = $.Deferred();
someAsyncCall(function(data){
dfd.resolve(data);
});
return dfd.promise();
};
var deferredTasks = [];
for(var i = 0; i < 3; i++){
deferredTasks.push(deferredTask());
// data structure for node
var Node = function(char,isLastChar){
this.char = char;
this.isLastChar = isLastChar;
this.children = {};
};
//adds a word to a node/tree
var addWord = function(tree,word){
var chars = word.split('');
//when adding a node to a tree, the currentNode starts as the tree