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
def update | |
@instructor = Instructor.find(params[:id]) | |
respond_to do |format| | |
if @instructor.update_attributes(params[:instructor][course]) | |
flash[:notice] = 'Instructor was successfully updated.' | |
format.html { redirect_to(@instructor) } | |
format.xml { head :ok } | |
else | |
format.html { render :action => "edit" } |
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
# SUPER DARING APP TEMPLATE 1.0 | |
# By Peter Cooper | |
# Link to local copy of edge rails | |
inside('vendor') { run 'ln -s ~/dev/rails/rails rails' } | |
# Delete unnecessary files | |
run "rm README" | |
run "rm public/index.html" | |
run "rm public/favicon.ico" |
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
# Install logrotate on OS X: | |
# sudo port clean --all logrotate && sudo port install logrotate | |
# Add e.g. this to your crontab: | |
# /opt/local/sbin/logrotate -s /Users/deploy/.logrotate/sites.status /Users/deploy/.logrotate/sites.conf | |
# This file would be sites.conf. | |
# See http://overstimulate.com/articles/logrotate-rails-passenger for more info. | |
daily | |
missingok | |
rotate 30 |
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
require '../lib/liquid' | |
class User | |
attr_accessor :name | |
liquid_methods :name | |
def initialize(name) | |
@name = name | |
end | |
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
# Mimic Mac OS X Finder's sort by name. | |
class Array | |
def finder_sort | |
sort_by { |s| s.to_finder_sort } | |
end | |
end | |
class String | |
def to_finder_sort | |
punctuation = %w[` ^ _ - , ; ! ? ' " ( ) [ ] { } @ *] + ['\\'] + %w[& # % + < = > | ~ $] |
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
/* | |
* a smart poller for jquery. | |
* (by github) | |
* | |
* simple example: | |
* | |
* $.smartPoller(function(retry) { | |
* $.getJSON(url, function(data) { | |
* if (data) { | |
* doSomething(data) |
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
def IRB.run_config | |
if @CONF[:RC] | |
begin | |
load rc_file | |
rescue LoadError, Errno::ENOENT | |
rescue | |
print "load error: #{rc_file}\n" | |
print $!.class, ": ", $!, "\n" | |
for err in $@[0, [email protected] - 2] | |
print "\t", err, "\n" |
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
require 'nokogiri' | |
require 'open-uri' | |
require 'stringex' | |
require 'git' | |
username = ARGV[0] | |
repo = ARGV[1] | |
base_url = "http://wiki.github.com/#{username}/#{repo}" |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Colors</key> | |
<dict> | |
<key>Background</key> | |
<string>0.082 0.087 0.109</string> | |
<key>InsertionPoint</key> | |
<string>1.000 1.000 1.000</string> |
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
javascript:if(!document.getElementById('download-youtube-video')){var%20video_id=null;var%20video_hash=null;var%20video_player=document.getElementById('movie_player');if(video_player){var%20flash_variables=video_player.attributes.getNamedItem('flashvars');if(flash_variables){var%20flash_values=flash_variables.value;if(flash_values){var%20video_id_match=flash_values.match(/[^a-z]video_id=([^(\&|$)]*)/);if(video_id_match!=null)video_id=video_id_match[1];var%20video_hash_match=flash_values.match(/[^a-z]t=([^(\&|$)]*)/);if(video_hash_match!=null)video_hash=video_hash_match[1]}}}if(video_id==null||video_hash==null){var%20args=null;try{args=yt.getConfig('SWF_ARGS')}catch(e){}if(args){video_id=args['video_id'];video_hash=args['t']}}if(video_id!=null&&video_hash!=null){var%20div_embed=document.getElementById('watch-embed-div');if(div_embed){var%20div_download=document.createElement('div');var%20div_download_code='%3Cbr%20/%3E%3Cspan%20id=\'download-youtube-video\'%3E%3Ca%20href=\''+'http://www.youtube.com/get_video?f |
OlderNewer