View Compressing and Concatenating JS
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
// hope this answers your question | |
//first follow the instructions for setting up narwhal | |
// http://karmaeducation.org/2010/01/15/getting-started-with-narwhal-a-standard-library-for-javascript/ | |
//update your catalog of available commonJS packages | |
// tusk is a lot like ruby's 'gem' command | |
$ tusk update | |
//then install yuicompressor, shrinksafe others |
View simple markup
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
<body> | |
<div id="kHeader"> | |
</div> | |
<!-- Put the help text here --> | |
<div id="kHelpText" title="Help Title"> Help text here</div> | |
<div id="feedback"></div> | |
<div id="gameArea"> | |
<div id="questionBox">What is this?</div> |
View gist:314503
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
function divide(a, b) { return function (callback, errback) { | |
// Use nextTick to prove that we're working asynchronously | |
process.nextTick(function () { | |
if (b === 0) { | |
errback(new Error("Cannot divide by 0")); | |
} else { | |
callback(a / b); | |
} | |
}); | |
}} |
View reverse.c
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
/* reverse: reverse string s in place */ | |
void reverse(char *s) | |
{ | |
int j = 0; | |
int temp = 0; | |
char *i = s; | |
s += strlen(s) - 1; | |
while (s != i){ |
View gist:387992
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 sys = require('sys'); | |
stdin = process.openStdin(); | |
process.addListener('SIGINT', function(){ | |
sys.puts('Received SIGINT'); | |
}); | |
var timeout = function(){ | |
setTimeout(timeout, 50); |
View Step Experiment
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
/* | |
* This demo program tries to rename 3 groups of files without overwriting any of the files in any other groups | |
* The files are numbered quasi-consecutively tmp1, tmp2, tmp3, tmp11, tmp12, tmp13, etc. | |
* I rename the files by adding 10 to the numeric part of the name | |
* tmp1 cannot be renamed to tmp11 until the original tmp11 has been renamed to tmp21 | |
* | |
*/ | |
var Step = require('ste |
View Step Experiment
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
/* | |
* This demo program tries to rename 3 groups of files without overwriting any of the files in any other groups | |
* The files are numbered quasi-consecutively tmp1, tmp2, tmp3, tmp11, tmp12, tmp13, etc. | |
* I rename the files by adding 10 to the numeric part of the name | |
* tmp1 cannot be renamed to tmp11 until the original tmp11 has been renamed to tmp21 | |
* | |
*/ | |
var Step = require('step'); | |
var fs = require('fs'); | |
var sys = require('sys'); |
View Step Experiment 2
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
/* | |
* This demo program tries to rename 3 groups of files without overwriting any of the files in any other groups | |
* The files are numbered quasi-consecutively tmp1, tmp2, tmp3, tmp11, tmp12, tmp13, etc. | |
* I rename the files by adding 10 to the numeric part of the name | |
* tmp1 cannot be renamed to tmp11 until the original tmp11 has been renamed to tmp21 | |
* | |
*/ | |
var Step = require('step'); | |
var fs = require('fs'); | |
var sys = require('sys'); |
View NodeQ1
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 sys = require('sys'), | |
spawn = require('child_process').spawn, | |
ls = spawn('ls', ['-lh', '/usr']); | |
ls.stdout.addListener('data', function (data) { | |
sys.print('stdout: ' + data); | |
}); | |
ls.stderr.addListener('data', function (data) { | |
sys.print('stderr: ' + data); |
View Step Experiment 4
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
/* | |
* This demo program tries to rename 3 groups of files without overwriting any of the files in any other groups | |
* The files are numbered quasi-consecutively tmp1, tmp2, tmp3, tmp11, tmp12, tmp13, etc. | |
* I rename the files by adding 10 to the numeric part of the name | |
* tmp1 cannot be renamed to tmp11 until the original tmp11 has been renamed to tmp21 | |
* | |
*/ | |
var Step = require('step'); | |
var fs = require('fs'); |
OlderNewer