Skip to content

Instantly share code, notes, and snippets.

View ericboehs's full-sized avatar

Eric Boehs ericboehs

  • Oddball
  • Enid, OK
  • 10:59 (UTC -05:00)
View GitHub Profile
diff --git a/app/controllers/add_photos.coffee b/app/controllers/add_photos.coffee
index db7e209..b269ecb 100644
--- a/app/controllers/add_photos.coffee
+++ b/app/controllers/add_photos.coffee
@@ -7,6 +7,13 @@ $.photoOptionDialog.addEventListener "click", (e) ->
newPhoto() if e.index is 0
existingPhoto() if e.index is 1
+cachick = Ti.UI.createButton
+ title: 'CACHICK'
@ericboehs
ericboehs / about.coffee
Last active August 29, 2015 13:56
Titanium script to open a link in Chrome or Safari. Be sure to set `appUrlScheme` in config.json.
openURL = (url, protocol='http') ->
Ti.Platform.openURL "#{protocol}://#{url}"
openApp = (e) ->
if e?.index == 1
protocol = e.source.alternativeProtocol
# Add Google Chrome specific callback params
if e.source.alternativeProtocol == 'googlechrome-x-callback'
url = "x-callback-url/open/?"
require "rest_client"
require "twitter"
URL = "http://www.oge.com/residential-customers/products-and-services/" +
"Positive-Energy-Smart-Grid/Pages/PriceSignal.aspx"
DATE_RE = Time.now.strftime("%A,\\s+%B\\s+%d,\\s+%Y")
unless ARGV.size == 4
abort "USAGE: #{$PROGRAM_NAME} CONSUMER_KEY CONSUMER_SECRET " +
"OAUTH_TOKEN OAUTH_TOKEN_SECRET"
@ericboehs
ericboehs / shifter.rb
Last active August 29, 2015 14:01
Shifting an 74HC595 (595) 8-bit shift register on a Raspberry Pi using Pi Piper
#!/usr/bin/env ruby
# To get pi_piper on Raspbian:
#
# apt-get install ruby-dev
# gem install pi_piper --no-ri --no-rdoc
# gem install rb-inotify --no-ri --no-rdoc
#
# These pins work but send a weird signal at boot.
#
# This script will take a string array and output it to the outputs on the shift register
class Safaritabswitching < Cask
url 'https://github.com/rs/SafariTabSwitching/releases/download/1.2.6/Safari.Tab.Switching-1.2.6.pkg'
homepage 'https://github.com/rs/SafariTabSwitching'
version '1.2.6'
sha256 :no_check
install 'Safari.Tab.Switching-1.2.6.pkg'
uninstall :script => { :executable => 'uninstall.tool', :input => %w[Yes] }
end
@ericboehs
ericboehs / spotify-playlist-example.rb
Last active August 29, 2015 14:02
Example ruby script to retrieve users playlists (including starred)
#!/usr/bin/env ruby
# encoding: utf-8
# Gemfile:
# source "https://rubygems.org"
#
# gem 'spotify'
# gem 'pry'
require "bundler/setup"
@ericboehs
ericboehs / readme.md
Last active August 29, 2015 14:02
Rails: pass friendship model to Popular's after_befriend callback

I wanted to do this with the popular gem:

class User < ActiveRecord::Base
  popular
  
  after_befriend :notify_friend
  
  def notify_friend(friend)
    puts "#{self.username} followed #{friend.username}"
 end
#!/usr/bin/env bash
# Ensure compiler isn't already installed
[[ -d /usr/local/gcc_arm/ ]] && echo 'gcc_arm already installed. Aborting...' && exit 1
echo '---> Downloading gcc arm to your current directory'
[[ ! -f gcc-arm-none-eabi-4_8-2014q2-20140609-mac.tar.bz2 ]] && \
curl https://s3.amazonaws.com/ericboehs-uploads/gcc-arm-none-eabi-4_8-2014q2-20140609-mac.tar.bz2 > gcc-arm-none-eabi-4_8-2014q2-20140609-mac.tar.bz2
# Rehosted on Amazon S3 as launchpad is really slow.
# If you are uncomfortable downloading from an unknown source, replace the above with:
@ericboehs
ericboehs / setup_wifi
Last active August 29, 2015 14:02
Script for automating connecting Spark Core device to WiFi via USB (OS X)
#! /usr/bin/env bash
#
# You will need the spark core cli installed first (and nodejs):
# npm install -g spark-cli
# spark cloud login
#
# To set SSID and PASSPHRASE, change below or run:
# git config spc.wifi.ssid YOUR_SSID
# git config spc.wifi.passphrase YOUR_PASSPHRASE
@ericboehs
ericboehs / alias.sh
Last active August 29, 2015 14:04
Merging github pull requests by ID
# These two aliases will allow you to check out the BRANCH that a PR is
# associated with by PR ID (gcopr) and also merge a pull request by ID into
# master (gmpr).
#
# I use this in conjunction with the ghi gem to allow me to review and merge pull
# requests from the command line. To show open pull requests (I alias this to `prs`):
#
# ghi list | grep --color=auto '↑' --color=none
# Git checkout pull request by ID