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
"one, two, three, one, four, one".split(',').collect{|s| s.strip}.uniq == ["one","two","three","four"] |
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 class Forum | |
{ | |
public ObjectId Id{get;set;} | |
public string Name{get;set;} | |
//no reference to all the posts | |
} | |
public class Thread | |
{ | |
public ObjectId Id{get;set;} |
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 'digest/sha1' | |
class Account | |
include MongoMapper::Document | |
attr_accessor :password | |
# Keys | |
key :name, String | |
key :surname, String | |
key :email, String |
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
Rake task: | |
task :version do | |
puts RUBY_VERSION | |
end | |
Terminal Output: | |
→ rvm list |
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
# COMMENT OF SCRIPT HERE | |
# you can make as many tabs as you wish... | |
# tab names are actually arbitrary at this point too. | |
--- | |
- tab1: | |
- title 'Git' | |
- cd ~/code/tekyll | |
- mate . | |
- clear | |
- tab2: |
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 'sj' | |
run SinatraJekyll |
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
source :gemcutter | |
gem 'sinatra', '1.1.0', :git => 'http://github.com/sinatra/sinatra.git' | |
gem 'RedCloth', '4.2.3' |
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
function mkgemset() { | |
mkdir $1 | |
echo 'source :gemcutter' > $1/Gemfile | |
touch $1/Rakefile | |
echo 'rvm_gemset_create_on_use_flag=1\nrvm gemset use' $1 > $1/.rvmrc | |
cd $1 | |
git init | |
mate . | |
} |
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
private static IEnumerable<AuditParameter> GetParametersFromEnumeration(IEnumerable args) | |
{ | |
var parameters = new List<AuditParameter>(); | |
foreach(var arg in args) | |
{ | |
var iaudit = arg as IAuditableParameter; | |
if(iaudit != null) | |
{ | |
parameters.Add(new AuditParameter {Value = iaudit.AuditParameter}); | |
continue; |
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 class BaseClass | |
{ | |
public string STRING { get { return "Base"; } } | |
} | |
public class ChildClass : BaseClass | |
{ | |
public new string STRING { get { return "Child"; } } | |
} |