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
github = GitHub.new | |
gist = github.create_application('gist') | |
gist.make_most_awesome_paste_site! |
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
*if block:* | |
Pretty straightforward. | |
<% if @property.floorplans.size == 1 %> | |
<div>Show This if the property only has 1 floorplan</div> | |
<% else %> | |
<div>Show This if the property has any other number of floorplans</div> | |
<% 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
#!/bin/bash | |
if [ -d $1 ]; then | |
echo "Directory $1 already exists" | |
exit | |
else | |
echo "Creating Rails project in ./$1 using edge rails..." | |
echo "- Making directory $1" | |
mkdir $1 |
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
# Rails template for a basic project assuming the following: | |
# | |
# - SQLite for DB | |
# - Git for version control | |
# | |
# Based on a similar template by: Brian Smith ([email protected]) | |
# Basic housekeeping | |
# | |
run "rm public/index.html" |
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
# application_controller.rb | |
before_filter :hijack_ie_default_format | |
def hijack_ie_default_format | |
if request.user_agent =~ /MSIE/ and params['format'].nil? | |
params['format'] = 'html' | |
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
module Rack | |
class Roll | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
if roll? | |
return [302, {'Location' => 'http://www.youtube.com/watch?v=oHg5SJYRHA0'}, ["You've been rick rolled"]] |
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
grep "Completed in [0-9]\{0,\}ms" log/production.log | sort -g -k3 | tail -100 |
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
Regular expression to validate URLs | |
^https?\:\/\/[a-z0-9\-]+(\.[a-z0-9\-]+)+(\:\d{1,5})?(/|/[a-z0-9\_\-\/\?\=\.]*)?$ | |
VALID | |
http://chrischerry.name | |
https://chrischerry.name | |
http://chrischerry.name/ | |
http://chrischerry.name:1234/ |
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
/^([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,6})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)$/i |
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
{"contributors":null,"text":"just testing, dont mind me","geo":null,"place":null,"in_reply_to_screen_name":null,"favorited":false,"source":"web","in_reply_to_user_id":null,"coordinates":null,"created_at":"Wed Jul 28 06:44:15 +0000 2010","user":{"lang":"en","profile_use_background_image":true,"profile_sidebar_fill_color":"efefef","following":null,"geo_enabled":false,"followers_count":106,"location":"San Diego, CA","verified":false,"profile_sidebar_border_color":"eeeeee","follow_request_sent":null,"notifications":null,"friends_count":88,"description":"Bleeding edge Web Applications Developer","favourites_count":0,"profile_background_color":"131516","url":"http://chrischerry.name","profile_image_url":"http://a1.twimg.com/profile_images/94668409/redfeedicon_528_normal.png","listed_count":7,"profile_background_image_url":"http://s.twimg.com/a/1279056489/images/themes/theme14/bg.gif","time_zone":"Pacific Time (US & Canada)","profile_text_color":"333333","protected":false,"statuses_count":2224,"created_at":"Thu Mar |
OlderNewer