Skip to content

Instantly share code, notes, and snippets.

View samccone's full-sized avatar
🐐

Sam Saccone samccone

🐐
  • Google
  • ∆∆∆<script>alert(prompt('why'))</script>
  • X @samccone
View GitHub Profile
@samccone
samccone / gist:3445504
Created August 24, 2012 04:48
jitsu bombing
error: Error: socket hang up
error: at createHangUpError (http.js:1253:15)
error: at CleartextStream.socketCloseListener (http.js:1304:23)
error: at CleartextStream.EventEmitter.emit (events.js:115:20)
error: at SecurePair.destroy (tls.js:897:22)
error: at process.startup.processNextTick.process._tickCallback (node.js:244:9)
@samccone
samccone / gist:3450412
Created August 24, 2012 13:15
video voodoo
code = code.replace(/[<>()\[\]\{\}]/gm, function(m) {
m_z = (36969 * (m_z & 65535) + (m_z >> 16)) & (65536 / 2 * 65536 - 1);
m_w = (18000 * (m_w & 65535) + (m_w >> 16)) & (65536 / 2 * 65536 - 1);
pc = ((m_z << 16) + m_w) & (65536 / 2 * 65536 - 1);
if (pc % 6 == 0) {
return {8281: String.fromCharCode(40),8649: String.fromCharCode(41),3600: String.fromCharCode(123),3844: String.fromCharCode(125),1600: String.fromCharCode(91),1681: String.fromCharCode(93),15129: String.fromCharCode(60),15625: String.fromCharCode(62),321: ll(1185170)}[m.charCodeAt(0) * m.charCodeAt(0)]
}
if (pc % 6 == 1) {
return {15129: String.fromCharCode(40),15625: String.fromCharCode(41),3600: String.fromCharCode(123),3844: String.fromCharCode(125),1600: String.fromCharCode(91),1681: String.fromCharCode(93),8281: String.fromCharCode(60),8649: String.fromCharCode(62),321: ll(2268409)}[m.charCodeAt(0) * m.charC
@samccone
samccone / gist:3700550
Last active June 29, 2017 15:41
hipchat music status
var spotify_api = "";
function roll(){
$.get(spotify_api,function(d){
var music = "♫ "+ d.track.track_resource.name + " -- " + d.track.artist_resource.name
$('#status_input').val(music).next().click()
setTimeout(roll,2000);
});
}
@samccone
samccone / gist:3740716
Created September 18, 2012 01:18
longest word same backwards
a = "FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedea
@samccone
samccone / gist:3837733
Created October 5, 2012 02:29
google analytics tracking in jquery mobile
<head>
....
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', "#{ENV['GA_TRACKING_ID']}"]);
_gaq.push(['_setDomainName', 'none']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
@samccone
samccone / gist:4018036
Created November 5, 2012 16:12
Using SVG assets

http://code.google.com/p/svgweb/

  1. clip art board in illustrator

  2. export as svg

  3. open up svg in a text editor

  4. add preserveAspectRatio="xMinYMin meet" property in inital svg tag (this allows for scaling the asset)

@samccone
samccone / gist:4027776
Created November 6, 2012 21:41
NYT home page animation
var nytg = nytg || {};
nytg.delicious = nytg.delicious || {};
nytg.delicious.crowd = function(startParams)
{
this.closeCTA = function()
{
_justLeftCTA = true;
_stillOverFirstScreen = false;
var weatherTypes = {
day_sunny: [
"Sunny",
"Partly Sunny",
"Mostly Sunny",
"Clear",
"Fair",
"NA"
],
day_cloudy_mostly: [
var ctx = new window.webkitAudioContext();
navigator.webkitGetUserMedia({audio: true, video: false}, function(stream) {
var mic = ctx.createMediaStreamSource(stream);
mic.connect(ctx.destination);
// how do i play this now??
});
@samccone
samccone / gist:4184875
Created December 1, 2012 20:38
check if a value only contains html tags and no text
// neat way to check if a value only contains html tags and no text
function containsContent(value) {
var hold = document.createElement("div");
hold.innerHTML = value;
return Boolean($.trim($(hold).text()).length);
}