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
search GET /search(.:format) search#show | |
api_api /api API::API | |
sidekiq /admin/sidekiq Sidekiq::Web | |
/ #<Rack::Builder:0x00000003edd110 @run=#<Grack::Server:0x00000003edcdf0 @config={:git_path=>"/usr/bin/git", :project_root=>"/home/git/repositories/", :upload_pack=>true, :receive_pack=>true}>, @map=nil, @use=[#<Proc:0x00000003edce18@/home/inflection/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.5/lib/rack/builder.rb:82>]> | |
help GET /help(.:format) help#index | |
help_api GET /help/api(.:format) help#api | |
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
# Setting up the master | |
echo "deb http://apt.puppetlabs.com precise main" > /etc/apt/sources.list.d/puppet.list | |
curl http://apt.puppetlabs.com/pubkey.gpg | apt-key add - | |
apt-get update | |
apt-get install puppetmaster | |
echo 'import "nodes"' > /etc/manifests/site.pp | |
touch /etc/manifests/nodes.pp | |
echo "127.0.0.1 puppet" > /etc/hosts | |
hostname puppet | |
echo "puppet" >> /etc/hostname |
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
# Belongs in your config/application.rb as far up as possible (Right under require statements should be good) | |
# Allow either 'prod' or 'production' rails env. | |
if ENV['RAILS_ENV'] == 'prod' | |
ENV['RAILS_ENV'] = 'production' | |
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
class Users < ActiveRecord::Base | |
attr_accessible( | |
:nickname, | |
) | |
# Set password to accessor so we can validate it below. | |
attr_accessor( | |
:password | |
) |
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
// Assuming environment is an EnvVars object, and mergeOptions is an arbitrary object that, when I call getMergeOptions(), returns the branch I'm merging with - Which can either be a string - or an environment variable, $some_var | |
String mergeTarget = ""; | |
if ( environment.get(mergeOptions.getMergeTarget()) != null ) { | |
mergeTarget = environment.get(mergeOptions.getMergeTarget().substring(1)); | |
} else { | |
mergeTarget = mergeOptions.getMergeTarget(); | |
} |
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
# Binary Search | |
def search array, num, first, last | |
middle = (first+last)/2 | |
if (first or last) == middle | |
return -1 | |
end | |
if num == array[middle] | |
return middle | |
elsif num > array[middle] | |
search(array, num, middle, last) |
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 BADASS | |
class Config | |
def initialize(config_file) | |
@config_file = config_file | |
end | |
def method_missing(method, *args) | |
if method.to_s =~ /[a-zA-Z0-9\-_]=$/ | |
puts method | |
puts args[0] |
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
<%= form_tag('/projects/build/', :method => "post") do %> | |
<%= label_tag(:revision, "Revision:") %> | |
<%= text_field_tag(:revision) %> | |
<%= submit_tag "Submit", :confirm => "You sure you want to do that?", :class => "btn btn-primary" %> | |
<% end %> | |
# In the controller: |
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
Foo.all.each do |f| | |
if Bar.where(:foo_id => f.id).all.empty? | |
puts "#{f.id} has no bars!" | |
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
flash[:notice] = "Hey, you're not allowed in there!" | |
return redirect_to( | |
:controller => 'projects', | |
:action => 'index', | |
:notice_type => 'error' | |
) |