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_server () { | |
cd /Library/WebServer/railsapps/$*; | |
touch tmp/restart.txt | |
# clear the screen | |
/usr/bin/open -a Terminal | |
/usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' | |
return 0 | |
#See a log | |
tail -f -n 0 log/development.log | |
} |
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.exports = { | |
pivotal: { | |
TOKEN: 'TOKEN' | |
PID: 'PID', | |
}, | |
sprintly: { | |
USER: "USER_EMAIL", | |
ID: 'PRODUCT_ID', | |
KEY: 'API_KEY' | |
}, |
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
console () { | |
eilzug $* | |
rails_version=`bundle exec rails -v` | |
if [[ $rails_version == *2.3* ]] | |
then | |
./script/console --irb=pry | |
elif [[ $rails_version == *3.* ]] | |
then |
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
# Run rake db:size to get a print of your database size in bytes. | |
# Run rake db:tables:size to get the sizes for individual tables | |
# Works for MySQL and PostgreSQL. Not tested elsewhere. | |
namespace :db do | |
desc 'Print data size for entire database' | |
task :size => :environment do | |
database_name = ActiveRecord::Base.connection.instance_variable_get("@config")[:database] | |
adapter = ActiveRecord::Base.connection.adapter_name.downcase |
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 ruby | |
# Written by Kieran P | |
# http://github.com/KieranP | |
# http://twitter.com/k776 | |
# http://k776.tumblr.com | |
# | |
# Feel free to fork and modify. | |
# If you do, send me a message on | |
# Github details changes and I'll |
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
=== Epic Snow Leopard Upgrayyyyd Guide === | |
Son, you’re now living in the land of 64-bit systems. | |
That means that some of your 32-bit shit is now broken. | |
Not all is lost. | |
== Fixing MySQL weirdness |
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
# PRINT TO KINDLE in Mac OSX (for Kindle DX) | |
# | |
# HUH? | |
# - Kindle file depository: | |
# - drag any supported Kindle file to a local folder | |
# - file will be automatically transfered whenever Kindle is connected | |
# - "Print To Kindle" Print menu option (PDF): | |
# - when Kindle is connected it will print as PDF straight to the Kindle (from anywhere) | |
# - when Kindle is not connected, it will print to the local folder and is transfered as soon as Kindle is connected |
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
# Check if element exists: | |
# <tt>xml.should have_xml_element("account")<tt> | |
# Use REXML syntax to address nested elements: | |
# <tt>xml.should have_xml_element("account/name")<tt> | |
# Check if element has certain value: | |
# <tt>xml.should have_xml_element("account/name").with_value("foo")<tt> | |
# or: | |
# <tt>xml.should have_xml_element("account", :value => "foo")<tt> | |
# Check if element has certain attribute: | |
# <tt>xml.should have_xml_element("account").with_attribute("type")<tt> |
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
# When a spammer wants to attack your site, they'll likely send an automated bot | |
# that will blindly fill out any forms it encounters. The idea of a "honeypot" is that | |
# you place a hidden field in a form. That's the honeypot. If this field is filled in, then | |
# it's almost certain to be a spammer (since a normal user wouldn't have even seen the | |
# field), and the contents of the form can safely be discarded. | |
# Normally, you would implement a "honeypot" in a Rails app with some combination of a | |
# special field in a particular form, and then some logic in the corresponding controller that | |
# would check for content in the "honeypot" field. This is somewhat of an inefficient | |
# approach, because it requires special code (not DRY), and bots are still going through an |
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/sh | |
#This is a start script for nginx. Tested on Unbuntu Edge. | |
#Should work on Ubuntu, Debian and probably a few other Linux distros. | |
#Change DAEMON and CONFIG_FILE if neccessary | |
PATH=/sbin:/bin:/usr/sbin:/usr/bin | |
#Location of nginx binary. Change path as neccessary |