Skip to content

Instantly share code, notes, and snippets.

View GarrettS's full-sized avatar

Garrett Smith GarrettS

View GitHub Profile
- return !!(node && method in node && node[method].apply);
1079 + return !!(node && method in node &&
1080 + (typeof node[method] === 'function' ||
1081 + String(node[method]).indexOf('function') === 1)); // IE reports as object, prepends space
It didn't look like it need much time, or to achieve any depth. Just
copy the source text and work down it inserting comments on the things
that stand out. When the first line of code is a 'fix' for pre-ECMA 262
3rd edition browsers (a standard that came out in 1999 and where the
most recent browser that needed the 'fix' is IE 4, in a system that does
not support IE in any version) then you don't need depth to see fault.
@GarrettS
GarrettS / newApply.js
Created March 10, 2011 05:49
newApply
function F(){}
function newApply(ctor, args) {
var i,
fp = F.prototype = ctor.prototype; // Copy prototype.
if(fp) {
fp.constructor = ctor;
}
i = new F;
ctor.apply(i, args); // Apply the original constructor.
return i;
@GarrettS
GarrettS / gist:1189225
Created September 2, 2011 17:26
toHexString = function (r, g, b)
var toHexString = function (r, g, b) {
return (toHexString = _toHexString)(r,g,b);
function _toHexString(r, g, b) {
return "#" + toHexByte(r) + toHexByte(g) + toHexByte(b);
}
function toHexByte(bite) {
var hex = bite.toString(16);
return (hex.length === 2 ? hex : "0" + hex);
}
};
@GarrettS
GarrettS / why-i-dislike-jquery
Created October 30, 2011 02:04
In Response to BadassJS "Why Do You Hate jQuery?"
<div style="white-space: normal">
Twitter anonymous user posted the question to me "Why do you hate jQuery?" The question implies that I have hatred of jQuery. I've been over the problems with jQuery over and over again. So much that I have long ago grown tired of it. I'll just sum them up here, with no code review. For links of jQUery code reviews, see "JavaScript Query Engines" article, on the site dhtmlkitchen.com (site was transferred to a new owner who had agreed to maintain it but instead dumped it).
Why do I dislike jQuery?
The initial design looked like a creative web programming experiment (and experimenting is a great way to learn, for sure).
But jQuery was touted as something of a general purpose solution to web scripting. Web authors having a very superficial and limited understanding of what they do, could now do things that they would have otherwise been incapable of. It was empowering to this class of developer.
However, for web developers who actually understand what they are doing, jQue
@GarrettS
GarrettS / jitsu deploy fatal
Created December 23, 2011 00:57
jitsu deploy FATAL ERROR
Garrett-Smiths-MacBook-Pro:~ garrettsmith$ jitsu apps deploy
info: Welcome to Nodejitsu
info: It worked if it ends with Nodejitsu ok
info: Executing command apps deploy
info: Authenticated as xkit
warn:
warn: Your package.json file is missing required fields:
warn:
warn: subdomain
warn:
@GarrettS
GarrettS / jitsu install http-server
Created December 23, 2011 01:09
Jitsu Install HTTP
Garrett-Smiths-MacBook-Pro:missionmassage garrettsmith$ jitsu install http-server
info: Welcome to Nodejitsu
info: It worked if it ends with Nodejitsu ok
info: Executing command install http-server
info: Installing http-server locally.
warn: Downloading packages from npm, this may take a moment...
info: http-server installed.
help: You can now jitsu deploy this application
prompt: Would you like to start this application locally? (yes): yes
warn: Outputting logs from: http-server
@GarrettS
GarrettS / where is node running
Created December 23, 2011 01:16
Where is Node Running ?!
PID COMMAND %CPU TIME #TH #WQ #PORT #MREG RPRVT RSHRD RSIZE
3414 top 8.7 00:02.83 1/1 0 24 33 1064K 244K 1644K
3406 bash 0.0 00:00.01 1 0 17 25 340K 244K 1020K
3405 login 0.0 00:00.02 1 0 22 53 464K 244K 1572K
3403 Terminal 15.0 00:00.81 5 1 110 113 3416K+ 26M 10M+
3402 mdworker 0.0 00:00.04 3 1 50 60 1448K 10M 3224K
3399 cvmsComp_x86 0.0 00:00.18 1 0 18 33 1480K 244K 5976K
3397 ocspd 0.0 00:00.02 1 0 23 28 536K 304K 1308K
3336 quicklookd 0.0 00:00.25 9 2 98 116 7160K 11M 14M
3327 WebProcess 0.0 00:00.28 5 2 105 138 9632K 17M 19M
@GarrettS
GarrettS / deploy fail 2
Created December 23, 2011 01:46
Jitsu Deploy fail II
Garrett-Smiths-MacBook-Pro:missionmassage garrettsmith$ jitsu deploy
info: Welcome to Nodejitsu
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Authenticated as xkit
warn:
warn: Your package.json file is missing required fields:
warn:
warn: subdomain
@GarrettS
GarrettS / police-state
Created January 9, 2012 08:21
They're setting the stage for violence in this country
Google:
NDAA - Indefinite Detention with no trial. $662 billion defense spending
HR 645 - "National Emergency Centers Establishment Act"
Internment / Resettlement Specialist (31E)
SOPA - Internet Censorship Bill
Civilian Inmate Labor Program
National Quick Response Team
Enemy Expatriation Act
USA PATRIOT
TSA