- Install stud
$ brew install https://raw.github.com/paulnicholson/homebrew/master/Library/Formula/stud.rb
- Download and install the powssl script
$ curl https://gist.githubusercontent.com/paulnicholson/2050941/raw/7e4d2178e3733bed18fdfe737277c3cb72241d39/powssl > ~/bin/powssl
$ chmod +x ~/bin/powssl
- Run powssl to create development certificate and configure stud.
$ powssl
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 stud | |
brew install https://raw.github.com/paulnicholson/homebrew/master/Library/Formula/stud.rb | |
# Download and install the powssl script | |
curl https://gist.githubusercontent.com/paulnicholson/2050941/raw/3ea59efe8c7e9013c265313045a9fdda5c653963/powssl > ~/bin/powssl | |
chmod +x ~/bin/powssl | |
# Add ~/bin to your PATH | |
export PATH="$HOME/bin:$PATH" |
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
class ApplicationController < ActionController::Base | |
protected | |
def rescue_optional_error_file(status_code) | |
known_codes = ["404", "422", "500"] | |
status = interpret_status(status_code) | |
if known_codes.include?(status_code) | |
render :template => "/errors/#{status[0,3]}.html.erb", :status => status, :layout => 'application.html.erb' | |
else | |
render :template => "/errors/unknown.html.erb", :status => status, :layout => 'application.html.erb' |
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
SELECT d.id as dept_id, d.department, count(f.id) as cnt | |
FROM departments d JOIN faculty f ON f.department_primary = d.id | |
GROUP BY d.department | |
UNION | |
SELECT d.id as dept_id, d.department, 0 as cnt | |
FROM departments d | |
WHERE d.id NOT IN (SELECT DISTINCT(department_primary) FROM faculty) | |
ORDER BY department ASC |
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
#!/bin/sh | |
# Author: John Trupiano | |
# Script to upgrade an REE installation on a hot server and maintain sane directory names | |
if [ "$(whoami)" != "root" ]; then | |
echo "You need to be root to run this!" | |
exit 2 | |
fi | |
RF_RELEASE=58677 |
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
<?php | |
$csv_terminated = "\n"; | |
$csv_separator = ","; | |
$csv_enclosed = '"'; | |
$csv_escaped = "\\"; | |
$db = new mysqli('[HOST]', '[USERNAME]', '[PASSWORD]', '[DATABASE]'); | |
$result = $db->query("SELECT * FROM [TABLE]"); | |
$field_count = $result->field_count; | |
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
<?php | |
# Testing without inputs | |
function _xprofile_registration_display_field( $field_input_name = 'field_1' ) { | |
$fields = array( | |
'field_1' => true, | |
'field_10' => true, | |
'field_2' => true, | |
'field_4' => true, | |
'field_6' => false | |
); |
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 'rubygems' | |
require 'hpricot' | |
require 'open-uri' | |
doc = open('http://railscasts.com/') { |f| Hpricot(f) } | |
total_episodes = (doc/'div.number').first.inner_html[1,3].to_i | |
total_pages = (total_episodes / 10).ceil | |
(1..total_pages).each do |i| | |
puts "PAGE #{i} ================================" |
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
RSpec::Matchers.define :be_valid do | |
match do |model| | |
model.valid? | |
end | |
failure_message_for_should do |model| | |
"expected valid? to return true, got false:\n #{model.errors.full_messages.join("\n ")}" | |
end | |
failure_message_for_should_not do |model| |
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
$(document).ready(function() { | |
$('.search select#search_tour_stop').filterBy('.search select#search_year'); | |
} | |
jQuery.fn.filterBy = function(watch) { | |
options = new Array; | |
target = $(this); | |
target.find('option').each(function(index, option) { |
OlderNewer