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
//This work licensed under the WTFPL License | |
//WTFPL: http://sam.zoy.org/wtfpl/. | |
using System; | |
namespace EntryExitThing | |
{ | |
internal class Program | |
{ | |
/// <summary> | |
/// Entrypoint for the application. |
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
# clear; spec spec/models/user_spec.rb -f specdoc --colour | |
require 'spec/spec_helper' | |
describe User, "add reputation via voting" do | |
let(:user) {User.new} | |
context "when starting from a brand new user" do | |
it "gives a user one reputation for free" do | |
user.reputation.should equal 1 |
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
just3ws:~ mdh$ uname -a | |
Darwin just3ws.local 10.6.0 Darwin Kernel Version 10.6.0: Wed Nov 10 18:11:58 PST 2010; root:xnu-1504.9.26~3/RELEASE_X86_64 x86_64 | |
just3ws:~ mdh$ echo $ARCHFLAGS | |
-arch x86_64 | |
just3ws:~ mdh$ rvm package install zlib | |
Fetching zlib-1.2.5.tar.gz to /Users/mdh/.rvm/archives |
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
abstract (1.0.0) | |
actionmailer (3.0.5) | |
actionpack (3.0.5) | |
activemodel (3.0.5) | |
activerecord (3.0.5) | |
activeresource (3.0.5) | |
activesupport (3.0.5) | |
annotate (2.4.0) | |
arel (2.0.9) | |
autotest-fsevent (0.2.5) |
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
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" | |
[[ -r $rvm_path/scripts/completion ]] && . $rvm_path/scripts/completion | |
export PATH=$rvm_path/bin:$PATH |
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
// The character array as a queue was clever but poorly implemented and unnecessary. | |
// Instead, just read the query from the input. | |
// Also handles mouse driven content actions (cut, paste, etc). | |
$(function() { | |
var filter = function(query) { | |
var titlesSelector = "#content .show h3 a"; | |
if (query == '') { | |
$(titlesSelector).closest(".show").show(); | |
} else { |
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
MyAppRoot/ | |
├── lib | |
└── tests | |
├── .simplecov | |
├── .rspec | |
├── config | |
├── features | |
├── fixtures | |
│ └── data.yml | |
└── specs |
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
# 1) Take any 3 digit number, But the first and third number Cannot be the same. | |
# 2) reverse the order and subtract | |
# 3) reverse the answer and then add it | |
"1234567890" | |
.split(//) | |
.map {|i| i.to_i } | |
.permutation(3) | |
.to_a | |
.map {|n| [n, n.reverse] } |
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
# The example I tweeted about preferring the more verbose if..then..else..end | |
# over ternary operations in Ruby got mangled by Twitter. | |
# So when my tweet showed everything on one line my message got muddled. | |
# The reformatting of my tweet also looked like I was trying to evaluate | |
# an expression that returned literally "true" or "false" which wasn't the case. | |
# What I wanted to show was that many people write IF/ELSE statements as | |
# ternary operations. |
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 self.models | |
ActiveRecord::Base | |
.send(:subclasses) | |
.map { |model| model.name.constantize } | |
end | |
def self.controllers | |
Rails.application.routes.routes | |
.select { |r| r.defaults[:controller].present? } | |
.uniq { |r| r.defaults[:controller] } |
OlderNewer