This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run specific test | |
ruby my_test -n test_my_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# always restart code like in development | |
touch tmp/always_restart.txt | |
# restart only once | |
touch tmp/restart.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# show files that will be removed | |
git clean -n | |
# remove files | |
git clean -f | |
#To remove directories, run | |
git clean -f -d #or git clean -fd | |
#To remove ignored files, run | |
git clean -f -X #or git clean -fX | |
#To remove ignored and non-ignored files, run | |
git clean -f -x #or git clean -fx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Figure | |
attr_reader :radius | |
def initialize(color,radius) | |
@color = color | |
@radius = radius | |
raise "first argument needs to be a string" unless color.class == String | |
raise "second argument needs to be a fixnum" unless radius.class == Fixnum | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://www.junauza.com/2010/04/remote-control-your-linux-desktop-using.html | |
# if auth error 18 happends | |
# need to allow plain auth for clients | |
gsettings set org.gnome.Vino require-encryption false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# search `pattern name` recursivelly from current folder | |
# only in css files | |
grep --include=\*.css -rnw ./ -e "pattern name" | |
# search word error | |
grep -i error /var/log/kern.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# show indexes | |
show INDEXES from table_name | |
when I should add index? | |
#when selectivity is big | |
selectivity = count of variations/all rows * 100% | |
#selectivity for sex column is low: sel_of_sex = 2(male, female)/10000 *100 = 0.02% | |
#http://www.programmerinterview.com/index.php/database-sql/selectivity-in-sql-databases/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
str = "https://some_cool_url" | |
uri = URI.parse(str) | |
http = Net::HTTP.new(uri.host, uri.port) | |
request = Net::HTTP::Get.new(uri.request_uri) | |
http.use_ssl = true | |
response = http.request(request) | |
p response.body |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
iterations = 100_000 | |
Benchmark.bm(27) do |bm| | |
bm.report('finding in hash') do | |
iterations.times do | |
arr.find{|h| h['start_date'] == '2018'} | |
end | |
end |