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
#functions | |
#is the branch dirty, if so echo a * | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
#if in a git repo echo branch name and dirty status | |
function parse_git_branch { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
echo "("${ref#refs/heads/}"`parse_git_dirty`)" |
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
#lang racket | |
(require data/heap) | |
(require racket/trace) | |
;globals | |
(define GOAL (list 1 2 3 4 5 6 7 8 0)) | |
(define GOAL-COORDINATES (list | |
(list 0 0) (list 0 1) (list 0 2) | |
(list 1 0) (list 1 1) (list 1 2) | |
(list 2 0) (list 2 1) (list 2 2))) |
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
module Todo | |
class API < Grape::API | |
use Rack::Session::Cookie | |
version 'v1', :format => :json | |
resource do | |
http_basic do |username, password| | |
User.authenticate(username, password) | |
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
module Todo | |
class API < Grape::API | |
use Rack::Session::Cookie | |
version 'v1', :format => :json | |
helpers do | |
def current_user | |
return nil if env['rack.session'][:user_id].nil? | |
@current_user ||= User.get(env['rack.session'][:user_id]) | |
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
describe TaskList do | |
let(:list) { TaskList.new } | |
let(:todo) { mock('todo').as_null_object } | |
describe '#tasks' do | |
context 'without tasks' do | |
it 'returns an empty array' do | |
list.tasks.should be_empty | |
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
require 'test_helper' | |
require 'clearance/testing' | |
class EmployeesControllerTest < ActionController::TestCase | |
test "an ASM can not create a user" do | |
sign_in | |
post :create, :employee => { :name => 'Feed Store' } | |
assert_raise CanCan::AccessDenied | |
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
class Message < ActiveRecord::Base | |
belongs_to :recipient, :class => 'User' | |
belongs_to :sender, :class => 'User' | |
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
html, body { min-height: 100%; } /* force the footer to always be at the bottom */ | |
body { | |
background: | |
url(layout/header.jpg) no-repeat scroll center top, | |
url(layout/header-bg.jpg) repeat-x scroll left top, /* allows screen to be resized w/o eventual cutoff */ | |
url(layout/footer.jpg) no-repeat scroll center bottom, | |
url(layout/footer-bg.jpg) repeat-x scroll left bottom; /* allows screen to be resized w/o eventual cutoff */ | |
} |
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
<%= search_form_for(@report.search, :url => report_path('sales', 'by_contact')) do |f| %> | |
<div class="input string optional"> | |
<%= f.label :aggregator_of_User_type_name_eq, 'Name' %> | |
<%= f.text_field :aggregator_of_User_type_name_eq %> | |
</div> | |
<%= f.submit %> | |
<% 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
#lib/tasks/db.rake | |
namespace :db do | |
desc 'Drops the DB, migrates it, and finally seeds it' | |
task :reload => [:drop, :migrate, :seed] | |
end |