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
<div id=colombia> | |
<div id=anqtioquia> | |
<div id=chigo> | |
<div id=plaza> | |
<div id=mesa1></div> | |
<div id=mesa2></div> | |
</div> | |
<div id=otro> | |
<div id=mesa4></div> | |
<div id=mesa5></div> |
# PostgreSQL. Versions 7.4 and 8.x are supported. | |
# | |
# Install the ruby-postgres driver: | |
# gem install ruby-postgres | |
# On Mac OS X: | |
# gem install ruby-postgres -- --include=/usr/local/pgsql | |
# On Windows: | |
# gem install ruby-postgres | |
# Choose the win32 build. | |
# Install PostgreSQL and put its /bin directory on your path. |
class User < ActiveRecord::Base | |
has_and_belongs_to_many :products_of_interest, :class_name => "Product" | |
has_and_belongs_to_many :brands_of_interest, :class_name => "Brand" | |
end | |
class Deal < ActiveRecord::Base | |
belongs_to :brand | |
belongs_to :product | |
end |
class User < ActiveRecord::Base | |
has_and_belongs_to_many :products_of_interest, :class_name => "Product" | |
has_and_belongs_to_many :brands_of_interest, :class_name => "Brand" | |
end | |
class Deal < ActiveRecord::Base | |
belongs_to :brand | |
belongs_to :product | |
end |
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
vector<int> insertion_sort(vector<int> numbers) { | |
int i,j,key; | |
for(int j=0; j<numbers.size(); j++) { | |
int key = numbers[j]; | |
i = j-1; | |
while(i>=0 && numbers[i]>key) { | |
numbers[i+1]=numbers[i]; | |
i--; | |
} |
Found this tip in comment here: http://www.tipb.com/2011/01/04/tipb-bug-home-button-working-iphone/ | |
1.) Open any application | |
2.) Press and hold the power button until the slide to shutdown swipe bar appears. | |
3.) Release Power button | |
4.) Press and hold Home button Lightly | |
until screen returns to icon screen |
using namespace std; | |
#include <algorithm> | |
#include <iostream> | |
#include <iterator> | |
#include <sstream> | |
#include <fstream> | |
#include <cassert> | |
#include <climits> | |
#include <cstdlib> | |
#include <cstring> |
void ranks(const string &v, map<char, int> &m){ | |
for(int i=0; i<v.size(); ++i) { | |
m[v[i]] = -1; | |
} | |
int c=0; | |
for(map<char, int>::iterator it = m.begin(); it != m.end(); it++) { | |
it->second = c++; | |
} | |
} | |
int winner(vector<string> votes) { |