Skip to content

Instantly share code, notes, and snippets.

View joshdick's full-sized avatar
💭
😋

Josh Dick joshdick

💭
😋
View GitHub Profile
@jcromartie
jcromartie / git-merged.rb
Created March 29, 2011 18:47
Git command to list merged (or unmerged with -u) branches
#!/bin/ruby
show_unmerged = ARGV[0] == '-u'
branches = `git branch -r`.split("\n")
branches.each do |branch|
is_merged = `git branch --contains #{branch}` =~ /master/
puts branch if show_unmerged ^ is_merged
end
anonymous
anonymous / pipes.sh
Created May 6, 2012 21:17
pipes.sh
#!/bin/bash
declare -i f=75 s=13 r=2000 t=0 c=1 n=0 l=0
declare -ir w=$(tput cols) h=$(tput lines)
declare -i x=$((w/2)) y=$((h/2))
declare -ar v=( [00]="\x83" [01]="\x8f" [03]="\x93"
[10]="\x9b" [11]="\x81" [12]="\x93"
[21]="\x97" [22]="\x83" [23]="\x9b"
[30]="\x97" [32]="\x8f" [33]="\x81" )
@ttscoff
ttscoff / searchFocus.bookmarklet.js
Created July 3, 2012 01:05
Bookmarklet to select the search field on the current page and focus it
javascript:var%20inputs=document.getElementsByTagName('input'),firstSearch=false,textinputs=[],i,t;for(i=0;i<inputs.length;i++)if(((inputs[i].type==='text')||(inputs[i].type==='search'))&&inputs.disabled!==true)textinputs.push(inputs[i]);for(t=0;t<textinputs.length;t++)if((/search/i).test(textinputs[t].className)||(/(^[sq]$|search|query)/i).test(textinputs[t].id)||(/^(q(uery)?|s|.*?search.*)$/).test(textinputs[t].name)){firstSearch=textinputs[t];break;}if(!firstSearch)textinputs[0].focus();else%20firstSearch.focus();
@Profpatsch
Profpatsch / PKGBUILD_mutt-sidebar-lunar
Created February 6, 2013 15:34
PKGBUILD for mutt with Lunar Linux sidebar patch.
## PKGBUILD [plain_text]
# Contributor: tobias [tobias [at] archlinux.org]
# Additional : Profpatsch [https://bbs.archlinux.org/misc.php?email=68112]
pkgname=mutt-sidebar
pkgver=1.5.21
pkgrel=8
pkgdesc='Small but very powerful text-based mail client'
url='http://www.mutt.org/'
license=('GPL')
@ttscoff
ttscoff / cliptextfile.sh
Created January 15, 2013 15:12
Copy the contents of any text file to the clipboard, intended for use as an OS X System Service
# A stupid script that actually makes a handy system service
# Use it to right click files and extract their text content to the clipboard
# Brett Terpstra 2013, no rights reserved
txtcount=`file "$@"|grep -c text`
response=0
msg=""
if [ $txtcount -eq $# ]; then
cat "$@"|pbcopy
if [ "$?" -ne "0" ]; then
msg="Error running command"
@lorenzoferrante
lorenzoferrante / Shortify.js
Created December 2, 2018 21:23
Get track or playlist URL from user query
// Base64 encoding of your credentials
let clientID = '<your client id>'
let clientSecret = '<your client secret>'
let cred = clientID + ':' + clientSecret
let credEncoded = Data.fromString(cred).toBase64String()
let auth = 'Basic ' + credEncoded
// Get token
let tokenURL = 'https://accounts.spotify.com/api/token'
var reqToken = new Request(tokenURL)
@i-scorpion
i-scorpion / README.txt
Created June 18, 2012 12:24
Twitter bootstrap fixed table header using jQuery
Here is a simple jQuery plugin to make a table header fixed on top when window is scrolled.
Using the code from twitter bootstrap documentation page, this code is customized for table header.
Create the table with following layout -
<table class="table-fixed-header">
<thead class="header">
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
@ChristoferK
ChristoferK / Open URLs in Safari.applescript
Created June 17, 2018 02:49
[Open URLs in Safari] An AppleScript that receives a list of URLs as input and opens them in new tabs of a specified existing window or, optionally, a new window, and can be set to do this in the background or by raising Safari to the foreground #Safari #tabs #URLs #AppleScript
property S : a reference to application "Safari"
global W
on run input -- input is a list of URLs
if (count input) is 0 then ¬
set the input to {¬
"alfredapp.com", ¬
"stackoverflow", ¬
"google.co.uk"}
@dperelman
dperelman / download_podcast.py
Last active January 27, 2020 02:10
Download all items in a podcast.
#!/usr/bin/env python
from __future__ import print_function
import datetime
import feedparser
import time
import os
import sys
from six.moves import urllib
@ttscoff
ttscoff / flavor.rb
Created September 16, 2012 16:01
Quick wrapper to convert Markdown to HTML via Github API
#!/usr/bin/ruby
# Convert a Markdown README to HTML with Github Flavored Markdown
# Github and Pygments styles are included in the output
#
# Requirements: json gem (`gem install json`)
#
# Input: STDIN or filename
# Output: STDOUT
# Arguments: "-c" to copy to clipboard (or "| pbcopy"), or "> filename.html" to output to a file
# cat README.md | flavor > README.html