Skip to content

Instantly share code, notes, and snippets.

@burin
burin / .jscs.json
Last active August 29, 2015 14:00
Burin's JSCS Config
{
"excludeFiles": ["node_modules/**", "script/**", "wrapped/**", "mobile/libs/**"],
"requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"],
"disallowLeftStickedOperators": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
"disallowRightStickedOperators": ["?", "+", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
"requireRightStickedOperators": ["!"],
"requireLeftStickedOperators": [","],
"disallowImplicitTypeConversion": ["string"],
"disallowKeywords": ["with"],
"disallowMultipleLineBreaks": true,
@burin
burin / 0_reuse_code.js
Last active August 29, 2015 14:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@burin
burin / util_extensions.swift
Last active August 29, 2015 14:17
How do i organize swift "utility" functions?
extension String {
func asTripDictionary() -> NSDictionary {
return ["wat":"wat"]
}
}
extension NSDate {
func asLocalISOString() -> String {
return "2015-03-12T13:24:00"
}
# Background: https://twitter.com/burin/status/608303217999544322
# > i just went on a whitespace fixing binge. is there a way to combine my git diff w/ git blame to see whose code i fixed most?
#
# This downloads the git-diff-blame script, and sets it to be executable
# Then you can run the script and give it two commit hashes, ./git-diff-blame old new
curl https://raw.githubusercontent.com/toddlipcon/tlipcon-bin/master/git-diff-blame -O -L
chmod +x git-diff-blame
./git-diff-blame 56f00b4 b3aaee4
@burin
burin / gist:15722b69c81c508ba45f
Created July 10, 2015 17:46
Publishing a Pull Request
http://chris.beams.io/posts/git-commit/
https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request#squash-your-changes
@burin
burin / gist:10752
Created September 14, 2008 19:07
My ~/.profile for ruby dev
# environment variables
export PATH=/usr/local/bin:$PATH
export PATH="$HOME/bin:$PATH"
export PATH=/usr/local/git/bin:$PATH
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
export MANPATH=/usr/local/git/man:$MANPATH
export EDITOR="mate -w"
export SVN_EDITOR="mate -w"
# aliases
# Short circuit a deliver_* methods defined in ActionMailer::Base subclasses.
def do_not_deliver!
def self.deliver! ; false ; end
end
development: &non-production
adapter: mysql
database: example_development
username: root
password:
host: localhost
timeout: 5000
test:
<<: *non-production
Rails::Initializer.run do |config|
%w(observers sweepers mailers).each do |dir|
config.load_paths << "#{RAILS_ROOT}/app/#{dir}"
end
end
--most referred questions in the past 7 days
select q.question, q.created_at as asked_on,count(1) as referrals from question_referrals r, questions q where r.question_id=q.id and r.created_at>SUBDATE(CURRENT_DATE(), INTERVAL 7 DAY) group by r.question_id order by referrals desc, asked_on desc