Skip to content

Instantly share code, notes, and snippets.

View GarrettS's full-sized avatar

Garrett Smith GarrettS

View GitHub Profile
@GarrettS
GarrettS / usurp-tco.js
Created January 29, 2012 18:58
UsurpTCO
javascript: void(function(){document.addEventListener("mousedown", tcoToLinkTitleURL, true); function tcoToLinkTitleURL(ev) { var target = ev.target; if(/^http(?:s?):\/\/t.co\//.test(target.href)) target.href=target.title; } }());
@GarrettS
GarrettS / usurp-tco.js
Created January 29, 2012 18:58
UsurpTCO
function tcoToLinkTitleURL(ev) {
var target = ev.target;
if(/^(http(?:s?):)?\/\/t.co\//.test(target.href) && /^(http(?:s?):)?\/\//.test(target.title)) {
target.href = target.title;
}
}
if(location.hostname == "twitter.com") {
document.addEventListener("mousedown", tcoToLinkTitleURL, true);
}
@GarrettS
GarrettS / ndaa-flyer
Created January 9, 2012 22:40
NDAA Flyer
[FRONT]
NDAA - Indefinite Detention with no trial.
[/FRONT]
[BACK]
NDAA of 2012
Indefinite Detention with no trial. On Dec 2011, Congress and President Obama passed NDAA 2012. NDAA goes against most of the bill of rights, habeas corpus, and posse comitatus.
Taxpayer Cost: $622 billion
@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
@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 / 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 / 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 / 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 / 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 / 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);
}
};