This file contains hidden or 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
- 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' |
This file contains hidden or 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
NoMethodError: undefined method `_run_before_destroy_callbacks' |
This file contains hidden or 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
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 |
This file contains hidden or 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
<?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>"; |
This file contains hidden or 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
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 |
This file contains hidden or 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
(function() { | |
function uncrippleFrame() { | |
var body = this.contentWindow.document.getElementsByTagName('body')[0]; | |
this.contentWindow.onclick = null; | |
body._frame = this; | |
body.onmousemove = function() { | |
this._frame.contentWindow.onclick = null; | |
this.setAttribute('style', '-webkit-user-select: auto;'); |
This file contains hidden or 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
#!/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 |
This file contains hidden or 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
#!/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 |
This file contains hidden or 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 UniqueId | |
def self.included(base) | |
raise StandardError, "model must have 'uuid'" unless base.columns.any? { |c| c.name == 'uuid' } | |
base.before_create do | |
self.uuid = UUID.generate unless uuid.present? | |
end | |
end | |
end |
This file contains hidden or 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
# using ruby: | |
$ echo $PATH | ruby -e 'STDIN.read.split(":").each { |l| puts l }' | |
$ echo $PATH | ruby -e 'print STDIN.read.gsub(":", "\n")' | |
# Using sed: I would expect this to work, but it does not | |
$ echo $PATH | sed 's/:/\n/g' |