Skip to content

Instantly share code, notes, and snippets.

View rboyd's full-sized avatar

Robert Boyd rboyd

  • Bentonville, AR
View GitHub Profile
@rboyd
rboyd / ios_detect.coffee
Created November 1, 2011 21:27
Detect iPhone user agent, offer app download, and javascript redirect to iTunes App Store
OFFER = 'We have an app available in the App Store! Download now?'
ITUNES_URL = '<Your iTunes URL Here>'
createCookie = (name,value,days) ->
if days
date = new Date()
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 365))
expires = '; expires=' + date.toGMTString()
else
expires = ''
@rboyd
rboyd / gist:1301682
Created October 20, 2011 17:06
themeforest experience
So, on 10/13 I bought this theme on themeforest:
http://themeforest.net/item/sparkling-landing-page-32-variations/204623?ref=An1ken
I bought it because I wanted to customize the iPhone screen and app icon tags for our new app launch. The theme clearly states that layered PSD is included, but when I open the PSD all of the iPhone related work is flattened into one layer, so it's pretty much useless for my purposes. All I want is either a refund (and the language on the template page to be clarified) or the resources on multiple layers so I can do the work I intended.
So I left a comment for the theme creator:
@rboyd
rboyd / gist:1230525
Created September 20, 2011 21:53
urban airship tags json
{
"tags": [
"CDT",
"language_en",
"iPad",
"country_US"
]
}
@rboyd
rboyd / MailchimpDeliveryMethod
Created June 22, 2011 15:01 — forked from ippy04/MailchimpDeliveryMethod
Delivery Method for Mailchimp STS and Amazon SES using Uakari
class MailchimpDeliveryMethod
attr_accessor :settings
def initialize(values = {})
self.settings = {:track_opens => true,
:track_clicks => true
}.merge!(values)
end
def deliver!(mail)
diff --git a/lib/rvm/shell/shell_wrapper.sh b/lib/rvm/shell/shell_wrapper.sh
index dd7fb06..6e90d47 100644
--- a/lib/rvm/shell/shell_wrapper.sh
+++ b/lib/rvm/shell/shell_wrapper.sh
@@ -2,12 +2,10 @@
__rvm_show_command_epilog() {
local last_command_result="$?"
echo "---------------RVM-RESULTS-START---------------"
- echo "---"
- echo " exit_status: \"$last_command_result\""
@rboyd
rboyd / gist:1010962
Created June 6, 2011 19:57
bare minimum example of shell_wrapper.sh issue
ubuntu@domU-12-31-39-0F-D4-BF:~$ export set ANYVAR='foo
> bar'
ubuntu@domU-12-31-39-0F-D4-BF:~$ irb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'rvm'
=> true
irb(main):003:0> RVM.list_known_strings
ArgumentError: syntax error on line 25, col 0: `bar'
from /usr/lib/ruby/1.8/yaml.rb:133:in `load'
@rboyd
rboyd / conv_gemfile.rb
Created February 9, 2011 05:20
converts Gemfile gems to chef recipe format
#!/usr/bin/ruby
gems_list = Array.new
ARGF.each do |line|
md = /.*\"([^\"]+)\".*(\"[^\"]+\")/.match(line)
gem_name = md.captures[0]
version = md.captures[1]
puts "gem_package \"#{gem_name}\" do\n version #{version}\nend\n\n"
end
@rboyd
rboyd / fader
Created January 24, 2011 03:16
#define LED 9
int i = 0;
void setup() {
pinMode(LED, OUTPUT);
}
void loop() {
for (i = 0; i < 255; i++) {
analogWrite(LED, i);
Chipmunk basic for OS X can be downloaded here: http://www.nicholson.com/rhn/basic/#3
The algorithm for binary conversion is a simple one, as described here: http://trunix.org/programlama/cpp/fred/notes/cpp/misc/decimal2binary.html
10 INPUT num
20 WHILE num > 0
30 m = num mod 2
40 out$ = str$(m) + out$
50 num = int(num/2)
60 WEND
@rboyd
rboyd / ec2-us-east-iptables-allow.txt
Created October 22, 2010 13:16
iptables rules for amazon ec2 us east region
# iptables allow rules for ec2 us east (http://developer.amazonwebservices.com/connect/ann.jspa?annID=795)
-A INPUT -s 216.182.224.0/20 -p tcp -m tcp --dport 22 -m state --state NEW -j ACCEPT
-A INPUT -s 72.44.32.0/19 -p tcp -m tcp --dport 22 -m state --state NEW -j ACCEPT
-A INPUT -s 67.202.0.0/18 -p tcp -m tcp --dport 22 -m state --state NEW -j ACCEPT
-A INPUT -s 75.101.128.0/17 -p tcp -m tcp --dport 22 -m state --state NEW -j ACCEPT
-A INPUT -s 174.129.0.0/16 -p tcp -m tcp --dport 22 -m state --state NEW -j ACCEPT
-A INPUT -s 204.236.192.0/18 -p tcp -m tcp --dport 22 -m state --state NEW -j ACCEPT
-A INPUT -s 184.73.0.0/16 -p tcp -m tcp --dport 22 -m state --state NEW -j ACCEPT
-A INPUT -s 184.72.128.0/17 -p tcp -m tcp --dport 22 -m state --state NEW -j ACCEPT