Skip to content

Instantly share code, notes, and snippets.

View saranrapjs's full-sized avatar

Jeff Sisson saranrapjs

View GitHub Profile
@saranrapjs
saranrapjs / lastmodified.js
Created December 31, 2011 00:38
Detect last-modified HTTP headers (via ajax) and use them
function updated_when() {
var xmlhttp;
var last_modified = {};
if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); }
else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
var lm_str = xmlhttp.getResponseHeader('Last-Modified');
if (lm_str != '') {
last_modified.date = new Date(lm_str);
@saranrapjs
saranrapjs / gist:2024853
Created March 12, 2012 21:41
Git status in bash prompt
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "("${ref#refs/heads/}") "
}
YELLOW="\[\033[0;33m\]"
PS1="\$(date +%H:%M) \w$YELLOW \$(parse_git_branch)\[\e[m\]\$ "
@saranrapjs
saranrapjs / embed.html
Created April 6, 2012 01:24
webring javascript
<div id="thanks-txt" style="width:343px;height:434px;">THANK YOU FOR SHOPPING HERE YOUR BUSINESS IS APPRECIATED</div>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//ilikenicethings.com/thanks.js ";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","thanks-js");</script>
@saranrapjs
saranrapjs / wordpres_url_shift.sql
Created June 22, 2012 18:19
Change wordpress url manually
UPDATE wp_options SET option_value = replace(option_value, 'http://OLD_URL', 'http://NEW_URL') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://OLD_URL','http://NEW_URL');
UPDATE wp_posts SET post_content = replace(post_content, 'http://OLD_URL', 'http://NEW_URL');
@saranrapjs
saranrapjs / smooth-breeze-corpus.txt
Created September 30, 2012 13:50
Smooth Breeze Corpus
Conjures mesmerizing songs for dream adventures.
Desert heat with a jazz beat.
The intro kicks off the funk from beat one and it doesn't stop.
Taking a lively, introspective look at the places, experiences and people who have shaped his life. There's something for everyone; from classic funk to contemporary swing.
A specially priced collection featuring today's top smooth jazz artists and their most groovin' tracks.
Ive covered contemporary jazz guitarist Matt Marshak since 2009 when he released Family Funktion, a masterfully produced album that wore funk very well so well, in fact, that I drew a comparison between his own funky and blue style on that album to that of the jazz/blues guitar man Jeff Golub. The similarities were uncanny.
Marshaks follow-up album, Urban Folktales, wore smooth as well as anyone could wear it. Here on Colors of Me, his latest offering, the guitarist, focuses mostly on those blues and smooth elements more than funk. Here might be some of Marshaks bluesiest blues, jazziest jazz,
@saranrapjs
saranrapjs / jack.js
Created December 13, 2012 15:05
Used to add durations to Guthrie's JACK FM data
var echonest = require('echonest'),
myNest = new echonest.Echonest({
api_key: 'XXX'
}),
sqlite3 = require('sqlite3').verbose(),
db = new sqlite3.Database('jack.sql.db');
function getDuration(artist,title,callback) {
if (artist.indexOf(",") !== -1 && artist.split(",").length == 2) { // NORMALIZE LAST, FIRST ARTISTS
if (artist.indexOf("&") !== -1) {
@saranrapjs
saranrapjs / gist:4747749
Created February 10, 2013 00:29
ffmpeg segmenting for HLS
ffmpeg -i "swipe_tabs.mp4" -map 0 -vbsf h264_mp4toannexb -f segment -segment_time 10 -segment_list test.m3u8 -segment_list_type flat -segment_format mpegts segment%d.ts
@saranrapjs
saranrapjs / url.sh
Created February 11, 2013 17:04
local bonjour url
dns-sd -P Wordpress _http._tcp local 80 www.wordpress.local $(ipconfig getifaddr en1)
@saranrapjs
saranrapjs / clone.js
Created February 26, 2013 18:28
clone stories quickly
setInterval(function() { $(".item-clone:first").click() }, 1500);
@saranrapjs
saranrapjs / gitlatest.sh
Last active December 14, 2015 07:09
Point yer browser to your latest Git commit on Github.com. Add to your .gitconfig. I'm usen "open" which is Mac-specific syntax to open in browser (I believe?) With kudos to http://dropshado.ws/post/4964571254/git-remote-show-origin
LATEST=$(git rev-parse HEAD) && REMOTE=$(git remote show -n origin | perl -ne '/Fetch URL: .*github\.com[:\/](.*\/.*)\.git/ && print $1') && FULL='https://github.com/'$REMOTE'/commit/'$LATEST && open $FULL
# added to your .gitconfig as an alias like so:
# [alias]
# point = !LATEST=$(git rev-parse HEAD);REMOTE=$(git remote show -n origin | perl -ne '/Fetch URL: .*github\.com[:\/](.*\/.*)\.git/ && print $1');FULL="https://github.com/"$REMOTE"/commit/"$LATEST;open $FULL;