This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Mute My Mac</title> | |
<link href="muteIcon.png" rel="apple-touch-icon"> | |
</head> | |
<body> | |
<?php exec("osascript -e \"set Volume 0\""); ?> | |
<h1>Mac Muted!</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you come across the need to store time as a float in ruby (I won’t judge you), | |
# you can use this bit of code. It assumes that each subpart of the time string is | |
# 60 parts of the previous part. This works for hours, minutes and seconds, | |
# regardless of how it is entered, and will always use the first "part" as the base | |
# measurement, i.e. 12:30 minutes becomes 12.5 minutes | |
j = 0 | |
timer = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pretty simple solution to harness the capability of multithreading without running into problems | |
# caused by doing too many things at once. | |
# In this example, I was trying to download hundreds of web pages, but opening all those connections | |
# simultaneously caused a variety of errors | |
# Contains download_link(link,save_dir,save_name) to download and save webpages locally (irrelevant) | |
require 'download_page' | |
# keep the threads in here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check to see if a domain is available (unregistered) | |
def available?(domain_name) | |
# Use Net::DNS library via ruby gems | |
require 'rubygems' | |
require 'net/dns/resolver' | |
res = Net::DNS::Resolver.new | |
# Use Google public DNS for speed | |
res.nameservers = ["8.8.8.8","8.8.4.4"] | |
res.udp_timeout=(60) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = false; | |
if(navigator.appName = "Microsoft Internet Explorer"){ | |
http = new ActiveXObject("Microsoft.XMLHTTP"); | |
} else { | |
http = new XMLHttpRequest(); | |
} | |
function doSomething(some_param){ | |
http.abort(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.upto(100){|n|p n%15==0&&"fizzbuzz"||n%5==0&&'buzz'||n%3==0&&'fizz'||''} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- line_item.ordered_values.each do |val| | |
"blah" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
09:35 AM jreese@Macintosh-2 (ruby-1.9.3-p194) ~/redacted | |
$ bundle exec rspec | |
bash: bundle: command not found | |
09:36 AM jreese@Macintosh-2 (ruby-1.9.3-p194) ~/redacted | |
$ rvm use system | |
Now using system ruby. | |
09:36 AM jreese@Macintosh-2 (system) ~/redacted | |
$ bundle exec rspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Spree | |
class PaymentMethod::Accpac < PaymentMethod | |
attr_accessible :preferred_client_id, :preferred_client_secret | |
#preference :client_id, :integer | |
#preference :client_secret, :string | |
def payment_profiles_supported? | |
false | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pid-57053 thread-4502503424 (CP Server Thread-7) Traceback (most recent call last): | |
pid-57053 thread-4502503424 (CP Server Thread-7) File "/Users/jreese/Dropbox/Code/python/www.gittip.com/env/lib/python2.7/site-packages/aspen/website.py", line 66, in handle_safely | |
pid-57053 thread-4502503424 (CP Server Thread-7) response = self.handle(request) | |
pid-57053 thread-4502503424 (CP Server Thread-7) File "/Users/jreese/Dropbox/Code/python/www.gittip.com/env/lib/python2.7/site-packages/aspen/website.py", line 99, in handle | |
pid-57053 thread-4502503424 (CP Server Thread-7) response = request.resource.respond(request) | |
pid-57053 thread-4502503424 (CP Server Thread-7) File "/Users/jreese/Dropbox/Code/python/www.gittip.com/env/lib/python2.7/site-packages/aspen/resources/dynamic_resource.py", line 47, in respond | |
pid-57053 thread-4502503424 (CP Server Thread-7) exec self.pages[1] in context | |
pid-57053 thread-4502503424 (CP Server Thread-7) File "/Users/jreese/Dropbox/Code/python/www.gittip.com/www/bank-acco |
OlderNewer