kubectl run nginx --image=nginx
kubectl run nginx --image=nginx --dry-run=client -o yaml
def user_params(user) | |
{ | |
id: user.cio_id, | |
first_name: user.first_name, | |
last_name: user.last_name, | |
email: user.email, | |
} | |
end | |
cio_client = Customerio::Client.new(ENV['CUSTOMER_IO_SITE_ID'], ENV['CUSTOMER_IO_API_KEY']) |
# === ruby books | |
# confident ruby | |
https://www.dropbox.com/sh/t4xu4t3hitqvqjy/AAAncKJ2s_9R-74WHv8zdVdYa?dl=0 | |
# fareless refactoring | |
https://www.dropbox.com/sh/pobxg0jpz7ndho1/AACS84n6AAFnx1ppl4M2MNjLa?dl=0 | |
# Sandy Metz Practical ruby design | |
https://www.dropbox.com/s/p8oejgchshk16ki/Sandi%20Metz%20-%20Practical%20Object-Oriented%20Design%20in%20Ruby.epub?dl=0 | |
# Rails as she is spoke 2012 | |
https://www.dropbox.com/s/jqvlcj15jv11hh3/Docfoc.com-Rails%20as%20She%20is%20Spoke.pdf?dl=0 | |
# lean-publishing-growing-rails-applications-in-practice-2014 |
mutex = Mutex.new | |
flags = [false, false, false, false, false, false, false, false, false, false] | |
threads = 50.times.map do | |
Thread.new do | |
100000.times do | |
puts flags.to_s | |
mutex.synchronize do | |
flags.map! { |f| !f } | |
end |
def match_urls_in_cities(file_names) | |
cities_count = {} | |
file_names.each do |file_name| | |
File.open(file_name, "r") do |f| | |
f.each_line do |line| | |
city_name = line.match(/(.*)\t/)[0].gsub("\t", "") | |
cities_count[city_name] ||= 0 | |
cities_count[city_name] += 1 if is_url_present?(line) | |
end | |
end |
func Backspace() | |
if col('.') == 1 | |
if line('.') != 1 | |
return "\<ESC>kA\<Del>" | |
else | |
return "" | |
endif | |
else | |
return "\<Left>\<Del>" | |
endif |
# I am working on new feature | |
$ git checkout -b some-new-feature | |
#Changed files, commit and push to source | |
git add . && git commit -m 'some cool changes' && git push origin some-new-feature | |
#After comments within pull request I need to fix some code | |
#After fix it and commit I can see 2 commits within git history | |
$ git add . && git commit -m 'some fix to cool changes' && git push origin some-new-feature | |
$ git log |
#create link | |
ln -s /path/to/file /path/to/symlink | |
#see all available memory | |
df -h | |
#returns the number of lines, words, and bytes in a file. Can use -l, -w, -c to get just one of these. | |
wc | |
# change user password |
["*", "%", "`", "-" ,"\\", "/", "[", "]", "{", "}", "&", "#", "$", "@", "!", "^", "(", ")", "'", '"', ',' ] |
# factory patern in ruby | |
http://rubyblog.com.ua/2016/04/factory-method-pattern-in-ruby | |
#ruby recursion | |
https://www.leighhalliday.com/recursion-in-ruby | |
# ruby on rails optimisation tips | |
https://infinum.co/the-capsized-eight/articles/top-8-tools-for-ruby-on-rails-code-optimization-and-cleanup | |
# write faster ruby app |