Skip to content

Instantly share code, notes, and snippets.

View waterlink's full-sized avatar

Alex Fedorov waterlink

View GitHub Profile
{есть алгоритм:}
const
N = 20;
var
n, i, j: integer;
a: array[1..N][1..N] of integer;
s: longint;
@waterlink
waterlink / 1793.cpp
Created August 19, 2011 20:59
timus Tarelki-2 1793rd problem
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
using namespace std;
double pi = acos(-1.);
@waterlink
waterlink / 1748_3.cpp
Created August 20, 2011 15:14
timus Samoe-Slozhnoe-Chislo 1748 problem 0_o precalca
#include <cstdio>
//#include "out.txt"
long long H1[] = {
1LL,
2LL,
4LL,
6LL,
16LL,
12LL,
RAILS_ENV=production rake db:setup
# produces the error below.....hmmm.....it's a no-worky
psql:/yourprojectpath/yourproject/db/structure.sql:29: ERROR: could not open extension control file "/usr/share/postgresql/9.1/extension/hstore.control": No such file or directory
# hstore postgresql extension needs to be installed, so....
sudo apt-get install postgresql-contrib
# now your extension should be available to enable so log in with psql
psql -d yourproject_production -U yourdbuser -W
# Tip 1
# Problem: Models are not loaded in migrations when config.threadsafe! is set
# Why: The threadsafe option in production doesn't load the dependencies
# Solution: Configure it to load dependencies with this option in your production.rb just after config.threadsafe!
# config/environments/production.rb
config.threadsafe!
config.dependency_loading = true
@waterlink
waterlink / Ruby.sublime-settings
Last active December 19, 2015 23:49
My ruby sublime text 3 settings
{
"font_size": 7.1,
"rulers": [79, 105],
"spell_check": true,
"tab_size": 2,
"translate_tabs_to_spaces": true,
"highlight_line": true,
"line_padding_top": -1,
"line_padding_bottom": -2,
"indent_guide_options": ["draw_active"],
@waterlink
waterlink / rails_tricks.md
Created August 12, 2013 18:36
Rails development tricks
# ~/.zshrc or ~/.bashrc

# allows you to remigrate your database to state of just changed or merged branch
alias nuke="rake db:drop db:create db:migrate db:test:prepare setup_sample_data"
@waterlink
waterlink / snippet.cpp
Created September 10, 2013 00:16
acm snippet
// snippet
// includes
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <cstring>
#include <iostream>