This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
##How Homakov hacked GitHub and the line of code that could have prevented it
Please note: THIS ARTICLE IS NOT WRITTEN BY THE GITHUB TEAM or in any way associated with them. It's simply hosted as a Gist because the markdown formatting is excellent and far clearer than anything I could manage on my personal Tumblr at peternixey.com.
If you'd like to follow me on twitter my handle is @peternixey
def reward_close(data): | |
fields = ['id','name','image_url','hint','message','type','allow_duplicates','active'] | |
print "Processing %i rewards" % len(data) | |
c.executemany( """INSERT INTO `ford_post_season`.`bv_rewards` (`%s`) VALUES (%s)""" % ('`, `'.join(fields), ', '.join(['%s'] * len(fields))), | |
[[reward[field].encode('utf-8') if hasattr(reward[field], 'encode') else reward[field] for field in fields] for reward in data]) |
[alias] | |
co = checkout | |
ci = commit | |
st = status | |
br = branch | |
fall = fetch --all | |
mr = merge | |
unstage = reset HEAD | |
pl = pull | |
ps = push |
NameError - uninitialized constant Octokit::Configuration: | |
/Users/applegatedt/.rvm/gems/ruby-1.9.3-p194@sinatra_auth_github/gems/warden-github-0.14.0/lib/warden/github/oauth.rb:62:in `build_uri' | |
/Users/applegatedt/.rvm/gems/ruby-1.9.3-p194@sinatra_auth_github/gems/warden-github-0.14.0/lib/warden/github/oauth.rb:27:in `authorize_uri' | |
/Users/applegatedt/.rvm/gems/ruby-1.9.3-p194@sinatra_auth_github/gems/warden-github-0.14.0/lib/warden/github/strategy.rb:48:in `begin_flow!' | |
/Users/applegatedt/.rvm/gems/ruby-1.9.3-p194@sinatra_auth_github/gems/warden-github-0.14.0/lib/warden/github/strategy.rb:25:in `authenticate!' | |
/Users/applegatedt/.rvm/gems/ruby-1.9.3-p194@sinatra_auth_github/gems/warden-1.2.3/lib/warden/strategies/base.rb:53:in `_run!' | |
/Users/applegatedt/.rvm/gems/ruby-1.9.3-p194@sinatra_auth_github/gems/warden-1.2.3/lib/warden/proxy.rb:354:in `block in _run_strategies_for' | |
/Users/applegatedt/.rvm/gems/ruby-1.9.3-p194@sinatra_auth_github/gems/warden-1.2.3/lib/warden/proxy.rb:349:in `each' | |
/Users/appl |
We are struggling to find a way to efficiently and cleanly implement the following common use case in our code base:
Vote
objects with its respective Project
, Discussion
or Comment
, if it existsVote
s in the same locations that we need access to the associated Vote object, such that the pattern for accessing them is clear, simple to repeatedly implement, and preferable to any sort of "hacky" workaround solution. (Such as making $userVote
a public property of the voted object, or defining a "shortcut" relation-that-is-not-a-relation to access the vote.)At several points in our code, we might do something similar to the following:
$parentClass = ParentClasses::model()->findOneByPk($parentClassId);
...
$sessions = $parentClass->sessions;
foreach ($sessions as $session) {
// Do something with the parent class of the session, perhaps
// rendering it in a subview
$parentClass = $session->parentClass;
echo $parentClass->title;
base_path = 'htdocs/protected/config' | |
Vagrant::Config.run do |config| | |
config.vm.define :web, primary: true do |web_config| | |
web_config.vm.box = 'my_company' | |
web_config.vm.box_url = 'http://files.vagrantup.com/precise64.box' | |
web_config.vm.network :hostonly, '192.168.33.10' |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Tom Hanks - My favorite actor!</title> | |
</head> | |
<body> | |
<h1>Tom Hanks Fan Page!</h1> | |
<img src="http://www.thewrap.com/wp-content/uploads/2014/02/OscarWrap-Tom-Hanks.jpg"> | |
<p>Tom Hanks is my favorite actor. He has had a long and impressive career playing everything from a boy trapped in an adult body in "Big", to a battle-hardened soldier in "Saving Private Ryan". I think my favorite part he played was as an AIDS patient in the critically-acclaimed movie "Philadelphia", for which he won both a Golden Globe and an Oscar. <a href="http://www.imdb.com/title/tt0107818/">Click here to learn more about "Philadelphia"</a>!</p> | |
<img src="http://farm4.static.flickr.com/3603/3475222867_193f5a8e16.jpg"> |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Tom Hanks - My favorite actor!</title> | |
</head> | |
<body> | |
<h1>Tom Hanks Fan Page!</h1> | |
<img src="http://www.thewrap.com/wp-content/uploads/2014/02/OscarWrap-Tom-Hanks.jpg"> | |
<h3>Why I love Tom Hanks</h3> | |
<p>Tom Hanks is my favorite actor. He has had a long and impressive career playing everything from a boy trapped in an adult body in "Big", to a battle-hardened soldier in "Saving Private Ryan". I think my favorite part he played was as an AIDS patient in the critically-acclaimed movie "Philadelphia", for which he won both a Golden Globe and an Oscar. <a href="http://www.imdb.com/title/tt0107818/">Click here to learn more about "Philadelphia"</a>!</p> |