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 PostsController < ApplicationController | |
def index | |
cookies[:index] = "INDEX" | |
session[:index] = "INDEX" | |
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
def friendly_name(user) | |
temp_name = if user.first_name.blank? && user.last_name.blank? | |
user.email | |
elsif user.first_name.blank? | |
user.last_name | |
elsif user.last_name.blank? | |
user.first_name | |
else | |
"#{user.first_name} #{user.last_name}" |
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
public class BaseClass | |
{ | |
public string STRING { get { return "Base"; } } | |
} | |
public class ChildClass : BaseClass | |
{ | |
public new string STRING { get { return "Child"; } } | |
} |
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
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 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
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 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
source :gemcutter | |
gem 'sinatra', '1.1.0', :git => 'http://github.com/sinatra/sinatra.git' | |
gem 'RedCloth', '4.2.3' |
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
require 'sj' | |
run SinatraJekyll |
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
# 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 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
Rake task: | |
task :version do | |
puts RUBY_VERSION | |
end | |
Terminal Output: | |
→ rvm list |
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
require 'digest/sha1' | |
class Account | |
include MongoMapper::Document | |
attr_accessor :password | |
# Keys | |
key :name, String | |
key :surname, String | |
key :email, String |