Skip to content

Instantly share code, notes, and snippets.

View vasche's full-sized avatar

Evgeny Voronin vasche

  • Moscow, Russia
View GitHub Profile
@vasche
vasche / 42-things.md
Created November 28, 2017 23:33 — forked from xdite/42-things.md
Ten (42) Things You Didn't Know Rails Could Do
@vasche
vasche / nginx-config-rails4-with-puma-ssl-version.conf
Created February 13, 2017 20:33 — forked from rkjha/nginx-config-rails4-with-puma-ssl-version.conf
Nginx config for rails 4 application using puma [ssl and non-ssl version]
upstream myapp_puma {
server unix:/tmp/myapp_puma.sock fail_timeout=0;
}
# for redirecting to https version of the site
server {
listen 80;
rewrite ^(.*) https://$host$1 permanent;
}
@vasche
vasche / ssl_puma.sh
Last active November 3, 2017 11:19 — forked from tadast/ssl_puma.sh
localhost SSL with puma
# 1) Create your private key (any password will do, we remove it below)
# Создайте свой закрытый ключ (подойдет любой пароль, мы удалим его командой ниже)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
# Удалить пароль
@vasche
vasche / version.rb
Created August 14, 2015 08:07
initilizer var version
# -*- encoding: utf-8 -*-
MAJOR = 0
MINOR = 0
TINY = 0
PRE = nil
VERSION = [MAJOR, MINOR, TINY, PRE].compact.join('.')
@vasche
vasche / slim.rb
Created August 14, 2015 08:05
initilizers
Slim::Engine.set_options :shortcut => {'@' => {:attr => 'role'}, '#' => {:attr => 'id'}, '.' => {:attr => 'class'}}
#
# Original version by Grant Parnell is offline (http://digitaldj.net/2011/07/21/trim-enabler-for-lion/)
# Update July 2014: no longer offline, see https://digitaldj.net/blog/2011/11/17/trim-enabler-for-os-x-lion-mountain-lion-mavericks/
#
# Looks for "Apple" string in HD kext, changes it to a wildcard match for anything
#
# Alternative to http://www.groths.org/trim-enabler-3-0-released/
# Method behind this madness described: http://forums.macrumors.com/showthread.php?t=1409151&page=4
# See discussion in comments here: https://www.macupdate.com/app/mac/39654/lion-tweaks
# And here: http://forums.macrumors.com/showthread.php?t=1410459
*.rbc
capybara-*.html
.rspec
/log
/tmp
/db/*.sqlite3
/public/system
/coverage/
/spec/tmp
**.orig
@vasche
vasche / gist:5523582
Created May 6, 2013 06:06
From http://jeffgardner.org/2011/08/04/rails-string-to-boolean-method/ Метод перевода строки в boolean. Установить в /config/initializers
class String
def to_bool
return true if self == true || self =~ (/(true|t|yes|y|1)$/i)
return false if self == false || self.blank? || self =~ (/(false|f|no|n|0)$/i)
raise ArgumentError.new("invalid value for Boolean: \"#{self}\"")
end
end