Skip to content

Instantly share code, notes, and snippets.

View the-teacher's full-sized avatar
💻
Working remotely

Ilya N. Zykin the-teacher

💻
Working remotely
View GitHub Profile
@the-teacher
the-teacher / fields.rb
Created February 23, 2014 15:49
AR model fields
LeaveBenefit.attribute_names.collect { |att| att.to_sym }
module.exports = (grunt) ->
# Project configuration.
grunt.initConfig
coffee:
options:
sourceMap: false
app:
expand: true
cwd: 'public/js/coffee/'
@the-teacher
the-teacher / commands
Last active August 29, 2015 13:57
Digital ocean - Ubuntu Rails
ssh root@146.185.xxx.xxx
ssh rails@146.185.xxx.xxx
mkdir -p ~/.ssh
cat ~/.ssh/id_rsa.pub | ssh root@146.185.xxx.xxx 'cat >> ~/.ssh/authorized_keys'
cat ~/.ssh/id_rsa.pub | ssh rails@146.185.xxx.xxx 'cat >> ~/.ssh/authorized_keys'
User: rails
def silence &block
(begin; yield; rescue; end;) if block_given?
end
@the-teacher
the-teacher / funny.rb
Created April 2, 2014 09:41
funny.rb
items_ids = folders_items.reduce( Hash.new{|h, k| h[k] = []}){ |hash, x|
hash[x.item_type].push x.item_id
hash
}
@the-teacher
the-teacher / test.svg
Created April 5, 2014 10:35
snowflake.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@the-teacher
the-teacher / pinprototype.js
Created April 5, 2014 13:28
pinprototype
http://jsfiddle.net/L6RU3/
@the-teacher
the-teacher / mac_os_install.txt
Last active August 29, 2015 14:01
mac_os_install
brew
brew update
brew doctor
tar -zxvf checkinstall-x.x.x.tar.gz
sublime
sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /bin/subl
$ ruby -v # ruby 2.0.0p247
@the-teacher
the-teacher / check_software.sh
Last active August 29, 2015 14:01
Check installed software
#!/bin/bash
# chmod 744 check_soft.sh
BLACK='tput setaf 0'
RED='tput setaf 1'
GREEN='tput setaf 2'
YELLOW='tput setaf 3'
BLUE='tput setaf 4'
MAGENTA='tput setaf 5'
CYAN='tput setaf 6'
@the-teacher
the-teacher / ruby.rb
Created June 9, 2014 07:36
1251 encode
$ x = "http://yandex.ru/yandsearch?text=%E4%E6%E0%E7%EE%E2%FB%E9+%EA%EE%EB%EB%E5%EA%F2%E8%E2&lr=213"
$ CGI.unescape x
=> "http://yandex.ru/yandsearch?text=\xE4\xE6\xE0\xE7\xEE\xE2\xFB\xE9 \xEA\xEE\xEB\xEB\xE5\xEA\xF2\xE8\xE2&lr=213"
$ x = CGI.unescape(x).force_encoding('windows-1251').encode
=> "http://yandex.ru/yandsearch?text=джазовый коллектив&lr=213"
$ x.encoding
=> #<Encoding:UTF-8>