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
doctype html | |
/[if lt IE 7] | |
html.no-js.lt-ie9.lt-ie8.lt-ie7 lang="en" | |
/[if IE 7] | |
html.no-js.lt-ie9.lt-ie8 lang="en" | |
/[if IE 8] | |
html.no-js.lt-ie9 lang="en" | |
| <!--[if (gte IE 8)]<!--> | |
<html class="no-js" lang="en"> <!--<![endif]--> | |
head |
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 'bundler/capistrano' | |
set :application, "net" | |
set :repository, "git@githost.com:net.git" | |
set :scm, :git | |
set :default_environment, { | |
'PATH' => "$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH" | |
} |
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
cat a b | sort | uniq > c # c is a union b | |
cat a b | sort | uniq -d > c # c is a intersect b | |
cat a b b | sort | uniq -u > c # c is set difference a - b | |
find . -type f -ls | |
find . -name \*.py | xargs grep some_function | |
cat hosts | xargs -I{} ssh root@{} hostname | |
cat access.log | egrep -o 'acct_id=[0-9]+' | cut -d= -f2 | sort | uniq -c | sort -rn |
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 'rake/testtask' | |
Rake::TestTask.new do |t| | |
t.libs << "lib" | |
t.libs << "test" | |
t.pattern = "test/*_test.rb" | |
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
# test/minitest_helper.rb | |
require "turn/autorun" | |
require "minitest/spec" | |
require "minitest/autorun" | |
Turn.config do |c| | |
c.format = :pretty | |
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
class Rule | |
def self.setters(*method_names) | |
method_names.each do |name| | |
send :define_method, name do |data| | |
instance_variable_set "@#{name}".to_sym, data. | |
end | |
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
require "minitest_helper" | |
class RuleTest < MiniTest::Unit::TestCase | |
def setup | |
end | |
def teardown | |
end | |
def test_stuff |
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 ThingsController < ActiveController | |
before_action :build_thing, only: [:new, :create] | |
before_action :load_thing, only: [:show, :edit, :update, :destroy] | |
def index | |
@thing = Thing.page(params[:page]) | |
end | |
def show | |
render |
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 Thing < ActiveRecord::Base | |
# == Constants ========================================================== | |
CONSTANTS = %w[ thing1 thing2 ] | |
# == Attributes ========================================================= | |
attr_accessor :attribute |
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_relative '../test_helper' | |
class ThingTest < ActiveSupport::TestCase | |
def test_fixtures | |
Thing.all.each do |thing| | |
assert thing.valid?, thing.errors.inspect | |
end | |
end |