Skip to content

Instantly share code, notes, and snippets.

View holyketzer's full-sized avatar

Alex Emelyanov holyketzer

View GitHub Profile

Commands examples

If the namespace is not used then the commands will perform on top of the default database. bundle exec rake db:create bundle exec rake db:migrate

By using the namespace we are going to use all the configuration for our alternate DB. bundle exec rake store:db:create bundle exec rake store:db:migrate

@holyketzer
holyketzer / latency.txt
Created December 1, 2019 10:02 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@holyketzer
holyketzer / rent_movie.sh
Last active August 29, 2015 14:10 — forked from maxd/rent_movie.sh
Integration test on Bash
#!/bin/sh
HOST='api.*****.com'
USER='[email protected]'
PASSWORD='password'
CLIENT_ID='web'
ACCESS_TOKEN=$(curl -s -X POST --data "grant_type=password&username=$USER&password=$PASSWORD" http://$HOST/api/oauth/token | jq -r '.access_token')
echo "Access Token: $ACCESS_TOKEN"
Spree::CheckoutController.class_eval do
def update_with_marketplace_sync
if @order.completed?
# Тут используешь @order или @current_order пока он ещё не обнулён и всё другое
end
update_without_marketplace_sync
end
alias_method_chain :update, :marketplace_sync
@holyketzer
holyketzer / tmux.md
Last active August 29, 2015 13:56 — forked from andreyvit/tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a