Skip to content

Instantly share code, notes, and snippets.

View saranrapjs's full-sized avatar

Jeff Sisson saranrapjs

View GitHub Profile
@saranrapjs
saranrapjs / mongod.sh
Created March 5, 2013 14:41
homebrew mongod start
sudo mongod --config /usr/local/etc/mongod.conf --fork
@saranrapjs
saranrapjs / 33rpm.js
Last active December 17, 2015 19:09
Bookmarklet for running <video> elements as if they were 45 RPM records playing at 33 RPM
var found = 0;
Array.prototype.slice.call(document.querySelectorAll('video')).forEach(function(me){ me.playbackRate = (33/45); found++; });
if (found === 0 && window.location.href.indexOf('www.youtube.com/watch?v=') !== -1) { // force HTML5 youtube
var id = window.location.href.substring(window.location.href.indexOf('watch?v=')+8);
if (id.indexOf('&') !== -1) id = id.substring(0, id.indexOf('&'));
if (confirm("To attempt to slow down this Youtube, we need to refresh the page, and then you can re-run this bookmarklet. Is this OK?")) {
window.location.href = 'http://www.youtube.com/watch_popup?v='+id;
}
}
tell application "Safari"
make new document at end of documents
set URL of document 1 to "http://www.fitbit.com/"
do JavaScript "function myValue() {return 10;} myValue();" in document 1
display dialog the result
end tell
@saranrapjs
saranrapjs / PHPUNIT.sublime-build
Created September 13, 2013 20:36
sublime build system for phpunit
{
"cmd": ["${project_path}vendor/bin/phpunit", "-c", "${project_path}test/phpunit.xml", "test"],
"file_regex": "php$",
"working_dir": "${project_path:${folder}}",
}
@saranrapjs
saranrapjs / youtube_slowed.bash
Last active December 27, 2015 15:09
Download & Slowdown a YouTube video using ffmpeg && youtube-dl
# add this to yer .bash_profile ==>
function youtube_slower {
if [ ! -z $2 ]; then
tempo="$2"
else
tempo="0.8"
fi
base_filename="$(youtube-dl "$1" --get-filename)"
extensionless="${base_filename%.*}"
@saranrapjs
saranrapjs / nyc_llc_bot.js
Created November 20, 2013 00:44
Code that generates the bot for https://twitter.com/NYCLLC
// requires: sqlite3, ntwitter
var sqlite3 = require('sqlite3'),
db = new sqlite3.Database('biz.db'),
twitter = require('ntwitter');
var twit = new twitter({
consumer_key: 'all',
consumer_secret: 'your',
access_token_key: 'tokens',
@saranrapjs
saranrapjs / varnish_test_cached.js
Last active August 29, 2015 13:57
PhantomJS script for deducing included resources using headless webkit, and determining which of them have been successfully cached by Varnish!
var system = require('system'),
fs = require("fs"),
CACHED_HEADER_NAME_REGEX = /X-Cache/,
CACHED_HEADER_VALUE_REGEX = /HIT/,
address,
parsedAddress,
cachedBytes = 0,
nocacheBytes= 0,
showAllURLS = false,
quiet = false,
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDFHp5VjLFBaRwe7JH4kG2SwhQpIH/d3AOhqX2zYJI66s2vNTDI1H20AuXCMqClOPSEGHEjz8lKVaSmHN0F2YKIwwTT9M6soqSHU5tk9h2/AjiH2dN7PhvTDAw88hxiqr9oE0QF9IyngCFgxbEzwHwOBmZsgYGJIlga4gneTKe/ufNq6Z6RydVK5sGWqv86tfPQUyUztC+ZqVlqsTV2+arLcZwwtpc9sR9pJZOxmHI8AfxE+GWFPJesQzQFvFH/Bs+G20g0a7QcRO45SY7j1FR9vzH7EuE8L673JtXvScHK7s3DBRqBgCEvVrQfUYXEc/TsEhh2MP4UH3C33QU+82sn jeffsisson@jeffs-imac.domain
javascript:var element1 = document.createElement(%27script%27);element1.src = %27https:%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1.4.4%2Fjquery.min.js%27;element1.type=%27text%2Fjavascript%27;document.getElementsByTagName(%27head%27)[0].appendChild(element1);var div = document.getElementById(%27ID-navPanelContainer%27).style; if(div) void(div.display=(div.display==%27none%27)%3F %27block%27:%27none%27);var div = document.getElementById(%27ID-reportTitle%27).style; if(div) void(div.display=(div.display==%27none%27)%3F %27block%27:%27none%27);var div = document.getElementById(%27ID-newKennedyHeader%27).style; if(div) void(div.display=(div.display==%27none%27)%3F %27block%27:%27none%27);var div = document.getElementById(%27ID-headerPanel%27).style; if(div) void(div.display=(div.display==%27none%27)%3F %27block%27:%27none%27);var div = document.getElementById(%27ID-overviewPanelTrafficSourceValueOrganicTable%27).style; if(div) void(div.display=(div.display==%27none%27)%3F %27block%27:%27none%27);var div
javascript:void($(%27%23ID-report div div div:contains(\%27Real-time reports do not include profile filtering\%27)%27).css(%27display%27,%27none%27));void($(%27%23ID-overviewPanelTrafficSourceNameTable%27).siblings(%27div%27).css(%27display%27,%27none%27));void($(%27%23ID-overviewPanelRequestUriTable%27).siblings(%27div%27).css(%27display%27,%27none%27));void($(%27%23ID-overviewPanelTrafficSourceValueOrganicTable%27).siblings(%27div%27).css(%27display%27,%27none%27));void($(%27%23ID-overviewPanelGeoComponent%27).siblings(%27div%27).css(%27display%27,%27none%27));void($(%27%23ID-reportHeader-titleSection%27).css(%27display%27,%27none%27));void($(%27%23ID-reportHeader-toolbarSection%27).css(%27display%27,%27none%27));void($(%27%23ID-report%27).css(%27padding%27,%270 60px%27));void($(%27%23ID-realtimeReportFootnote%27).css(%27display%27,%27none%27));void($(%27%23ID-mainLayoutContainer%27).css(%27background-color%27, %27%23FFF%27));void($(%27body%27).css(%27background-color%27, %27%23FFF%27));void($(%27%23main-bo