Skip to content

Instantly share code, notes, and snippets.

@begin29
begin29 / custom_pryrc.rb
Created June 26, 2017 08:32
custom pryrc with scratch file
load 'scratch.rb'
include Scratch
default_command_set = Pry::CommandSet.new do
command "scratch!", "reload scratch" do |str|
load 'scratch.rb'
end
end
Pry.config.commands.import default_command_set
@begin29
begin29 / js_equal.txt
Created June 22, 2017 10:52
how js compare statements works
# if(statement)
https://i.stack.imgur.com/MKgie.png
#if statement1 == statement2
https://i.stack.imgur.com/5bdbd.png
#if st1 === st2
https://i.stack.imgur.com/mmvud.png
@begin29
begin29 / ubuntu_applets
Created June 5, 2017 20:09
list of ubuntu default programs and applets
# network manager applet
nm-applet
@begin29
begin29 / i3_settings.sh
Last active May 17, 2017 10:20
i3 related settings
# linux symbols
http://panmental.de/symbols/info.htm
#shows special keys matching(alt, ctrl, win)
xmodmap
# for windows, setup diff windows on start
https://faq.i3wm.org/question/243/how-do-i-use-an-exclude-regex-in-i3-config/%3C/p%3E.html
# back workspace to external monitor
@begin29
begin29 / apache_settings.sh
Created May 10, 2017 06:44
apache settings
# add new user to apache authorization
# /etc/apache2/.htpasswd - authorization file, can be rewtitted by website
# apache configuration
sudo htpasswd /etc/apache2/.htpasswd another_user
@begin29
begin29 / ruby_mini_test.sh
Created May 9, 2017 10:37
mini test commands
# run specific test
ruby my_test -n test_my_test
@begin29
begin29 / bash_useful.sh
Last active May 8, 2017 09:53
bash useful commands
# check if variables is set
if [[ $1 ]]; then
echo 'variable is set!'
else
echo 'ERROR: variable is not set!'
fi
@begin29
begin29 / rails_commands.rb
Last active May 3, 2017 09:47
Rails commands
# copy migrations from engine
rake railties:install:migrations
# record not new/new
persisted? # new_record?
# execute query in console
ActiveRecord::Base.connection.execute("foo")
# string to class
@begin29
begin29 / git.rb
Last active March 14, 2017 13:48
Usefull git commads
# show changed files for specific commit
git show --pretty="format:" --name-only SHA
#debugging with git
https://git-scm.com/book/ru/v1/%D0%98%D0%BD%D1%81%D1%82%D1%80%D1%83%D0%BC%D0%B5%D0%BD%D1%82%D1%8B-Git-%D0%9E%D1%82%D0%BB%D0%B0%D0%B4%D0%BA%D0%B0-%D1%81-%D0%BF%D0%BE%D0%BC%D0%BE%D1%89%D1%8C%D1%8E-Git
# cheatsheet for git
https://medium.com/@ABatickaya/%D1%88%D0%BF%D0%B0%D1%80%D0%B3%D0%B0%D0%BB%D0%BA%D0%B0-%D0%BF%D0%BE-git-55eeea487676#.gmoc1vf40
git log --after="2013-11-12 00:00" --before="2013-11-12 23:59"
@begin29
begin29 / passenger_rails.rb
Created March 2, 2017 09:16
passenger commands
# always restart code like in development
touch tmp/always_restart.txt
# restart only once
touch tmp/restart.txt