View gist:790299
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
$('form').submit(function() { | |
// get all the inputs into an array. | |
var $inputs = $('#form :input'); | |
// get an associative array of just the values. | |
var values = {}; | |
$inputs.each(function() { | |
values[this.name] = $(this).val(); | |
if ($(this).val() == "") { | |
alert("You haven't filled out all the fields"); |
View gist:869865
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
users = [] | |
xml.search('//dc:creator').each do |user| | |
unless users.include?(user) | |
users << user.inner_text | |
end | |
end |
View gist:955514
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
# Rakefile | |
require File.dirname(__FILE__) + '/config/boot.rb' | |
require 'thor' | |
require 'padrino-core/cli/rake' | |
PadrinoTasks.init |
View migration.rb
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 AddAreasPortfolioEntries < ActiveRecord::Migration | |
def self.up | |
create_table "areas_portfolio_entries", :id => false do |t| | |
t.references :portfolio_entry | |
t.references :area | |
end | |
add_index :areas_portfolio_entries, :portfolio_entry_id | |
add_index :areas_portfolio_entries, :area_id | |
end |
View template.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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title><%= browser_title(yield(:title)) %></title> | |
<meta charset='<%= ::Refinery::Application.config.encoding %>' /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> | |
<%= raw "<meta name=\"description\" content=\"#{@meta.meta_description}\" />" if @meta.meta_description.present? -%> | |
<%= raw "<meta name=\"keywords\" content=\"#{@meta.meta_keywords}\">" if @meta.meta_keywords.present? -%> |
View deploy.sh
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
# $ deploy dev // Deploys to staging | |
# $ deploy // Deploys to production | |
function deploy() { | |
if [[ $@ != "" ]]; then | |
git push staging $@:master | |
else | |
git push production | |
fi | |
} |
View gist:1123012
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
-(id)initWithName:(NSString *)n description:(NSString *)d url:(NSString *)u; |
View 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title><%= browser_title(yield(:title)) %></title> | |
<% unless Rails.env == "production" %> | |
<meta name="robots" content="noindex" /> | |
<% end %> | |
<meta charset='<%= ::Refinery::Application.config.encoding %>' /> |
View notify.rb
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
#!/usr/bin/env ruby | |
# Created by _zsh for r/trees | |
require 'rubygems' | |
require 'hpricot' | |
require 'open-uri' | |
require 'growl' | |
View canonical_redirect.rb
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 CanonicalRedirect | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
request = Rack::Request.new(env) | |
if request.host =~ /^example.com/ | |
[301, {"Location" => request.url.sub("//", "//www.")}, self] |
OlderNewer