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 SessionsController | |
| def create | |
| user = log_in_user | |
| user.send_current_notifications! | |
| end | |
| def log_in_user | |
| account = #sign in with params | |
| UserFactory.user_for_account(account) | |
| 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
| RED="\[\033[1;31m\]" | |
| YELLOW="\[\033[1;33m\]" | |
| GREEN="\[\033[1;32m\]" | |
| NOCOLOR="\[\033[1;0m\]" | |
| function parse_git_branch { | |
| ref="$(git branch 2> /dev/null | sed -n "/*/ p" | awk '{ print $2 }')" | |
| if [ -n "$ref" ]; then | |
| echo "("${ref#refs/heads/}")" | |
| fi |
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
| syntax enable | |
| syntax on | |
| set cursorline | |
| set expandtab | |
| set ts=2 | |
| set shiftwidth=2 | |
| set autoindent | |
| set number | |
| set background=dark | |
| set nobackup |
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 prr { | |
| bundle exec rake routes | fgrep :action | \ | |
| \ | |
| awk '{ | |
| method=""; | |
| for(i=1;i<=NF;i++){ | |
| if ($i ~ /^\//){ | |
| example_url=$i; | |
| } | |
| else if($i ~ /[GET|PUT|POST|DELETE]/){ |
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 MakeUserToInvite | |
| def self.make(community_id=55,first_name=nil,last_name=nil,email=nil) | |
| p = Person.new | |
| p.first_name = first_name || random_string | |
| p.last_name = last_name || random_string | |
| e = EmailAddress.create(:person => p, | |
| :email_address => (email || "#{random_string}@aoeuaoue.com"), | |
| :confirmed_status => "confirmed", | |
| :is_primary => true) | |
| e.save |
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
| vi -o $(git status | grep modified | awk '{print $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
| function kk { | |
| echo "" | |
| echo "The epubs on your desktop are:" | |
| cd ~/Desktop; | |
| index=0 | |
| FILES=() | |
| for i in $(find . -name \*epub); do |
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
| count=0; for i in $(find . -name \*.rb); do count=`expr $count + $(git blame $i | grep "Anthony Broad" | wc -l)`; done; echo "ABC wrote $count lines of code"; |
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
| schema () | |
| { | |
| sed -n "/table \"$1\"/,/^ *end/ p" db/schema.rb | |
| } |
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
| #!/usr/bin/env Rscript | |
| triangle <- read.table("padded_triangle.txt") | |
| size <- 100 | |
| for(r in (size-1):1){ | |
| for(c in r:1){ | |
| max_value = max(triangle[r+1,c],triangle[r+1,c+1]) | |
| triangle[r,c] <- triangle[r,c] + max_value | |
| } | |
| } | |
| print(triangle[1,1]) |