Skip to content

Instantly share code, notes, and snippets.

View makeusabrew's full-sized avatar
💭
I may be slow to respond.

Nick Payne makeusabrew

💭
I may be slow to respond.
View GitHub Profile
@makeusabrew
makeusabrew / 1) uglify.js
Created October 25, 2011 11:54
Watch a specified directory's JavaScript files and recompile a specified output file if any changes are detected
/**
* Sample usage - note that the trailing slash on the watch directory is important!
*
* node uglify.js /path/to/my/src/directory/ /path/to/my/output/file.js
*/
var jsp = require('uglify-js').parser,
pro = require('uglify-js').uglify,
fs = require('fs');
@makeusabrew
makeusabrew / alert-simple.js
Created November 6, 2011 16:23
bootbox.js - simple alert
bootbox.alert("Hello world!");
@makeusabrew
makeusabrew / alert-callback.js
Created November 6, 2011 16:26
bootbox.js - alert with callback
bootbox.alert("Hello World!", function() {
// any code you want to happen after the alert is dismissed
console.log("Alert dismissed");
});
@makeusabrew
makeusabrew / alert-custom-label.js
Created November 6, 2011 17:30
bootbox.js - alert with custom label
bootbox.alert("Custom label text!", "Very good.");
@makeusabrew
makeusabrew / confirm-simple.js
Created November 6, 2011 17:39
bootbox.js - simple confirm
bootbox.confirm("Are you sure?");
@makeusabrew
makeusabrew / confirm-callback.js
Created November 6, 2011 17:43
bootbox.js - confirm with callback
bootbox.confirm("Are you sure?", function(result) {
if (result) {
console.log("User confirmed dialog");
} else {
console.log("User declined dialog");
}
});
@makeusabrew
makeusabrew / confirm-custom-labels.js
Created November 6, 2011 17:46
bootbox.js - confirm with custom labels
bootbox.confirm("Are you sure?", "No way!", "Yes, definitely!", function(result) {
console.log("Confirmed? "+result);
});
@makeusabrew
makeusabrew / dialog-simple.js
Created November 6, 2011 17:51
bootbox.js - simple dialog
bootbox.dialog("Hello there!");
@makeusabrew
makeusabrew / dialog-label-callback.js
Created November 6, 2011 17:55
bootbox.js - dialog with label and callback
bootbox.dialog("Hi there!", {
"label": "OK",
"callback": function() {
console.log("callback");
}
});
@makeusabrew
makeusabrew / dialog-label-callback-alternative.js
Created November 6, 2011 17:58
bootbox.js - dialog with label and callback, alternative syntax
bootbox.dialog("Hi there!", {
"OK": function() {
console.log("callback");
}
});