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 | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the nginx web server | |
# Description: starts nginx using start-stop-daemon |
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 ContactForm < Form | |
attr_accessor :name, :email, :message | |
validates_presence_of :name, :email, :message | |
def save | |
# do something | |
end | |
end |
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 | |
def hello_loop(*names) | |
names.each do |name| | |
puts "Hello #{name}" | |
end | |
end | |
hello_loop("Gafitescu", "D_Roch", "Steven Ng", "n0x13", "hosheng", "Pratik Desal", "r kumar", "Ashley Moran", "persiancoffee", "Andre Fischer") |
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 | |
def say_hello(name) | |
puts "Hello #{name}" | |
end | |
%w{Gafitescu D_Roch Steven Ng n0x13 hosheng Pratik Desal r kumar Ashley Moran persiancoffee Andre Fischer}.each do |person| | |
say_hello(person) | |
end |
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
public static class ConventionHelper | |
{ | |
public static string PluralUnderscore(string name) | |
{ | |
return Underscore(Inflector.Net.Inflector.Pluralize(name)); | |
} | |
public static string Underscore(string name) | |
{ | |
var lowered = name.ToLowerInvariant(); |
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
// ideas for the new restful-routing dsl, inspired by the rails 3 router | |
public class WebsiteApp : RestfulRoutingApp | |
{ | |
public WebsiteApp() | |
{ | |
Resource<SessionController>(() => Only.New.Create); | |
Namespace("admin", () => | |
{ | |
Resources<BlogsController>(() => | |
{ |
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 User | |
include MongoMapper::Document | |
key :email, String | |
key :encrypted_password, String, :limit => 128 | |
key :salt, String, :limit => 128 | |
key :confirmation_token, String, :limit => 128 | |
key :remember_token, String, :limit => 128 | |
key :email_confirmed, Boolean, :default => false, :null => 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
class ActiveSupport::TestCase | |
def setup | |
clear_all_collections | |
end | |
def clear_all_collections | |
# ruby 1.9 compatability | |
Dir[File.join(Rails.root, 'app/models/**/*.rb')].each do |model_path| | |
klass = File.basename(model_path, '.rb').classify.constantize | |
klass.collection.remove if klass.respond_to?(:collection) |
NewerOlder