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
import re | |
from jinja2 import Markup | |
from SOMEOTHERLIBRARYFOROTHERSTUFF import format_user_input | |
def strip_auth_tokens(value): | |
from classlet.models import auth_token_re | |
return auth_token_re.sub(u'', value) | |
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 Notification < ActiveRecord::Base | |
belongs_to :user | |
scope :for_user, lambda { |user| where(:user_id => user.id) } | |
scope :unexpired, where('expired_at is null') | |
delf self.expire! | |
with_scope 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
# monkey-patch https://github.com/ryanb/cancan/issues/327 | |
# put in Rails.root/config/initializers/cancan.rb | |
module CanCan | |
module ModelAdapters | |
class ActiveRecordAdapter | |
private | |
# fix nested imbrication | |
def merge_conditions(sql, conditions_hash, behavior) | |
if conditions_hash.blank? |
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
queue = [] | |
providerA = (args...) -> | |
console.log args | |
providerB = (args...) -> | |
alert args | |
doRequest = (args...) -> | |
queue.push args |
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
ABAP | |
filter remove_matches ^\* | |
extension abap | |
3rd_gen_scale 5.00 | |
ADSO/IDSM | |
filter remove_matches ^\s*\*[\+\!] | |
extension adso | |
3rd_gen_scale 3.00 | |
AMPLE | |
filter remove_matches ^\s*// |
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
#!/bin/bash | |
for source in $(ls -d -1 $PWD/home/*); do | |
destination="$HOME/.$(basename $source)" | |
current=$(readlink $destination) | |
if [ "$current" = "$source" ]; then | |
echo "Already $source" | |
else | |
if [ "$current" ]; then | |
echo "Previously $current" |
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
" Configure plugin loading. | |
" This `filetype` dance is to correctly handle various | |
" environments and their defaults for file type detection | |
" and a weird OS X bug which causes a non-zero exit code. | |
filetype on | |
filetype off | |
call pathogen#runtime_append_all_bundles() | |
call pathogen#helptags() | |
filetype plugin indent on | |
syntax on |
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
set fuoptions=maxvert,maxhorz | |
" Enforce line length | |
highlight OverLength ctermbg=lightred ctermfg=black guibg=#ffd5d5 | |
match OverLength /\%80v.\+/ | |
set guifont=Droid\ Sans\ Mono:h13,Consolas:h14 | |
" Highlight all instances of the word under the cursor. |
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
- ['foo', 'bar'] | |
- ['a', 'b'] |
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
#!/bin/bash | |
export APP_ENV=$1 | |
shift | |
if [ -z "$APP_ENV" ]; then | |
echo "Usage: $(basename $0) APP_ENV [ARGUMENTS...]" | |
echo "ARGUMENTS are forwarded to $(which env)" | |
exit 1 | |
fi |
OlderNewer