Skip to content

Instantly share code, notes, and snippets.

View todd's full-sized avatar
🤘

Todd Bealmear todd

🤘
View GitHub Profile
@todd
todd / current_spotify_song.scpt
Last active April 24, 2019 10:00
AppleScript to Get Current Song from Spotify formatted for Tmux Status Bar
tell application "System Events"
set processList to (name of every process)
end tell
if (processList contains "Spotify") is true then
tell application "Spotify"
set artistName to artist of current track
set trackName to name of current track
set symbol to "◻︎"
set col to "red"
@todd
todd / tmux_battery_indicator.sh
Last active August 29, 2015 14:04
Variable Color Battery Indicator for Tmux Status Bar on OS X
#!/bin/sh
input=$(pmset -g batt)
battery_level=$(echo $input | pcregrep -o1 -i "(\d+)%" | bc)
charging=$(echo $input | grep "AC")
color=yellow
bolt=""
if [ "$battery_level" -gt 75 ]; then
color=green
@todd
todd / libmpdclient_test.go
Last active August 29, 2015 14:00
Go-libmpdclient Binding Test
package main
/*
#cgo pkg-config: libmpdclient
#include <stdlib.h>
#include <mpd/client.h>
*/
import "C"

Keybase proof

I hereby claim:

  • I am todd on github.
  • I am todd (https://keybase.io/todd) on keybase.
  • I have a public key whose fingerprint is BF41 F6FA F4EC 9E09 D940 0471 1549 098F 40CD 729D

To claim this, I am signing this object:

@todd
todd / atom_snippets.cson
Last active August 29, 2015 13:56
Helpful Atom Snippets (Work in Progress)
'.source.ruby':
'RSpec describe':
'prefix': 'describe'
'body': 'describe "${1:class_or_method}" do\n $0\nend'
'RSpec context':
'prefix': 'context'
'body': 'context "$1" do\n $0\nend'
'RSpec expect':
@todd
todd / state_validator.coffee
Created February 17, 2013 08:18
State abbreviation validator for Parsley.js in CoffeeScript.
$("#multipage").parsley
validators:
state: (val)->
val.toUpperCase() in [
'AK','AL','AR','AS','AZ','CA','CO','CT','DC','DE','FL','GA','GU','HI',
'IA','ID','IL','IN','KS','KY','LA','MA','MD','ME','MH','MI','MN','MO',
'MS','MT','NC','ND','NE','NH','NJ','NM','NV','NY','OH','OK','OR','PA',
'PR','PW','RI','SC','SD','TN','TX','UT','VA','VI','VT','WA','WI','WV',
'WY'
]
@todd
todd / Preferences.sublime-settings
Created November 19, 2012 07:12
Awesome Sublime Text 2 Settings
{
"font_size": 12.0,
"bold_folder_labels": true,
"caret_style": "phase",
"highlight_line": true,
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,
"scroll_past_end": true,
"spell_check": true,
"show_full_path": true
@todd
todd / 2.0.0-preview1.sh
Created November 2, 2012 02:01
Shell Script to Install Ruby-2.0.0-preview1 with rbenv
curl https://raw.github.com/gist/3998177/0ac991d732fbfba9f3d8cfd14b861461ef2d9393/2.0.0-preview1 > /tmp/2.0.0-preview1
rbenv install /tmp/2.0.0-preview1
@todd
todd / 2.0.0-preview1
Created November 2, 2012 01:55
rbenv installation script for Ruby 2.0.0-preview1
install_package "yaml-0.1.4" "http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz"
install_package "ruby-2.0.0-preview1" "http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-preview1.tar.gz"
@todd
todd / shovel.py
Created April 10, 2012 06:17
Shovel file for Jekyll tasks
'''
This is a Shovel (https://github.com/seomoz/shovel) script
that will create new Jekyll content and automatically
generate the YAML Front Matter boilerplate.
'''
import datetime
import os.path
import re
import sys