Skip to content

Instantly share code, notes, and snippets.

View vsizov's full-sized avatar

Valeriy Sizov vsizov

  • Portugal, Lisbon
View GitHub Profile
import random
BotCount = 0 # Score
Count = 0
print("hi, now you are going to play with numbers")
print("your goal is to say number which is greater then computer's")
#print("# you can't use same number twice")
print("to continue write 'OK'")
startAnswer = input()
@vsizov
vsizov / gist:4500870
Created January 10, 2013 09:55
Automatically reload gems in rails 3.2.7 on every request in development
# Source: http://timcardenas.com/automatically-reload-gems-in-rails-327-on-eve
# Inside config/environments/development.rb
# Do the following after every request to the server in development mode
ActionDispatch::Callbacks.to_cleanup do
# If the gem's top level module is currently loaded, unload it
if Object.const_defined?(:MyCoolGem)

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets

@vsizov
vsizov / tmux.conf
Created November 29, 2016 14:32 — forked from spicycode/tmux.conf
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
select f.*, count(*) cnt
from feedbacks f
LEFT JOIN feedbacks fn ON fn.id = (SELECT MAX(id) FROM feedbacks WHERE customer_id = f.customer_id)
WHERE (f.comment IS NOT NULL OR f.testimonial IS NOT NULL) AND f.company_id = 42
GROUP BY f.recommend;
@vsizov
vsizov / gist:9247282
Last active December 25, 2015 12:15 — forked from schacon/gist:942899
delete all remote branches that have already been merged into master
$ git branch -r --merged origin/master |
grep origin |
grep -v '>' |
grep -v master |
xargs -L1 |
awk '{split($0,a,"/"); print a[2]}' |
xargs git push origin --delete
@vsizov
vsizov / git-pristine.sh
Last active December 25, 2015 12:14 — forked from sleistner/git-pristine.sh
Remove all remote and local branches except master and next
#!/bin/bash
git branch -d -r `git branch -r | awk '{ if ($0 !~ /next|master/) printf "%s", $0 }'`
git branch -D `git branch | awk '{ if ($0 !~ /next|master/) printf "%s", $0 }'`
class LastPayReport
def initialize employees
@employees = employees
end
def get_rows
@employees.map do |employee|
employee.compensations.last_two
class UsersField < ActiveRecord::Base
belongs_to :user
belongs_to :field
has_one :fields_group, through: :field
validates :value, allow_blank: true
def create_record
if !self.field.required & self.value.blank?
<%= simple_form_for @product do |f| %>
<%= f.simple_fields_for :attributes do |d| %>
<% f.object.attributes.try(:each) do |key, value| %>
<%= d.input key, :input_html => {:value => value } %>
<% end %>
<% end %>
<% end %>