Skip to content

Instantly share code, notes, and snippets.

View jerodsanto's full-sized avatar
:shipit:
Always be shipping

Jerod Santo jerodsanto

:shipit:
Always be shipping
View GitHub Profile
@jerodsanto
jerodsanto / ios5_notify.sh
Created October 12, 2011 13:50
Siri, tell me when iOS 5 is available. Nothing? Fine. Bash, you do it.
#!/bin/bash
while :
do
echo "Checking for iOS 5: `date`"
result=`curl -s -L http://phobos.apple.com/version | grep Restore | grep iPhone | grep 5.0`
if [ -z "$result" ]; then
echo "Nothing yet..."
else
say "I O S 5 IS NOW AVAILABLE. GO GET YOUR DOWNLOAD ON, KID"
fi
@jerodsanto
jerodsanto / set_wallpaper.rb
Created September 20, 2011 15:11
MacRuby script to set wallpaper on all connected monitors
#!/usr/bin/env macruby
abort "Usage: #{__FILE__} [image]" if ARGV.empty?
framework "Cocoa"
wallpaper_path = File.expand_path(ARGV.first)
wallpaper_url = NSURL.fileURLWithPath(wallpaper_path, isDirectory: false)
workspace = NSWorkspace.sharedWorkspace
def online_users(since = 5)
sessions = ActiveRecord::SessionStore::Session.where("updated_at >= ?", since.minutes.ago)
user_ids = sessions.all.map { |session| session.data["user_id"] }
User.where(:id => user_ids)
end
<?php
foreach ($images as $index => $image) {
if ($index % 3 == 0) {
echo "<div class='yox_row'>";
}
echo "<div class='yox_cell'>";
echo get_resource_link($image);
echo "</div>";
Pledgee.where(:email_me => true).each do |pledgee|
if [1.week, 3.weeks, 6.weeks].include? pledgee.days_since_pledge
PledgeeMailer.reminder_email(pledgee).deliver
end
end
@jerodsanto
jerodsanto / error.txt
Created December 10, 2010 18:27
this works in Rails 2, but not in Rails 3.
NoMethodError: undefined method `_run_before_destroy_callbacks'
- f.semantic_fields_for :contributions, obj, :child_index => i do |child_form|
= child_form.input :person_id, :collection => Person.all.collect { |p| [p.name, p.id]}, :include_blank => false, :label => 'Contributor Name'
= child_form.input :name, :label => 'Type'
(function($) {
var thisIsPrivate = function(number) {
console.log("this can only be called from inside this scope", number);
}
var soIsThis = 4;
$.Model.extend('MyModel',
/* static */
{
==> Build Environment
CC: /usr/bin/cc => /usr/bin/gcc-4.2
CXX: /usr/bin/c++ => /usr/bin/c++-4.2
LD: /usr/bin/cc => /usr/bin/gcc-4.2
CFLAGS: -O3 -march=core2 -msse4.1 -w -pipe
CXXFLAGS: -O3 -march=core2 -msse4.1 -w -pipe
MAKEFLAGS: -j2
==> Downloading http://kernel.org/pub/software/scm/git/git-1.7.2.1.tar.bz2
File already downloaded and cached to /Users/jerod/Library/Caches/Homebrew
/usr/bin/tar xf /Users/jerod/Library/Caches/Homebrew/git-1.7.2.1.tar.bz2
def self.find_with_destroyed *args
self.with_exclusive_scope { find(*args) }
end
def destroy
return false if callback(:before_destroy) == false
self.deleted_at = current_time_from_proper_timezone
result = update_without_callbacks
callback(:after_destroy)
result