Skip to content

Instantly share code, notes, and snippets.

View STRML's full-sized avatar

Samuel Reed STRML

View GitHub Profile
@STRML
STRML / gist:3154212
Created July 21, 2012 01:47
Variable declaration hoisting
(function foo(){bar = 10; var bar = 20;}());
alert(bar) // ReferenceError: bar is not defined
(function foo(){bar = 10;}());
alert(bar) // 10
@STRML
STRML / fixperms.sh
Created June 30, 2012 19:11
A few useful files for running a nodejs server. I keep update-project.js in /root so when I ssh in I can just run it. my-project.conf runs the project as the user 'www-data', and so fixperms.sh makes sure the project folder is readable/writable.
#!/bin/sh
T=/usr/local/mycompany/my-project
chown -R www-data:root $T
find $T -type d ! -perm 770 -print -exec chmod 770 {} \;
find $T -type f ! -perm 660 ! -name "*.sh" -print -exec chmod 660 {} \;
find $T -type f ! -perm 770 -name "*.sh" -print -exec chmod 770 {} \;
@STRML
STRML / dumpExtLoader.js
Created May 10, 2012 13:51
Simple PhantomJS file that dumps the contents of Ext.Loader
var page = require('webpage').create(),
t, address;
if (phantom.args.length === 0) {
console.log('Usage: dumpExtLoader.js <some URL>');
phantom.exit();
} else {
page.onConsoleMessage = function (msg) {
console.log(msg);
};
@STRML
STRML / phantomjs-jsb.js
Created May 10, 2012 13:07
Working phantomjs-jsb.js for use with ExtJS4 & (experimentally) Sencha Touch 2
// This belongs in %SDK%/compat/scripts/
(function() {
var defaultJsb3Object = {
"projectName": "Project Name",
"licenseText": "Copyright(c) 2012 Company Name",
"builds": [
{
"name": "All Classes",
"target": "all-classes.js",