VIM Editor Commands
Text Entry Commands (Used to start text entry)
a Append text following current cursor position
A Append text to the end of current line
i Insert text before the current cursor position
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
#!/usr/bin/env bash | |
# Simple move this file into your Rails `script` folder. Also make sure you `chmod +x puma.sh`. | |
# Please modify the CONSTANT variables to fit your configurations. | |
# The script will start with config set by $PUMA_CONFIG_FILE by default | |
PUMA_CONFIG_FILE=config/puma.rb | |
PUMA_PID_FILE=tmp/pids/puma.pid | |
PUMA_SOCKET=tmp/sockets/puma.sock |
# ANSI color codes | |
RS="\[\033[0m\]" # reset | |
HC="\[\033[1m\]" # hicolor | |
UL="\[\033[4m\]" # underline | |
INV="\[\033[7m\]" # inverse background and foreground | |
FBLK="\[\033[30m\]" # foreground black | |
FRED="\[\033[31m\]" # foreground red | |
FGRN="\[\033[32m\]" # foreground green | |
FYEL="\[\033[33m\]" # foreground yellow | |
FBLE="\[\033[34m\]" # foreground blue |
VIM Editor Commands
Text Entry Commands (Used to start text entry)
a Append text following current cursor position
A Append text to the end of current line
i Insert text before the current cursor position
require 'yaml' | |
require 'logger' | |
require 'active_record' | |
include ActiveRecord::Tasks | |
class Seeder | |
def initialize(seed_file) | |
@seed_file = seed_file | |
end |
require "json" | |
require "benchmark" | |
def measure(no_gc = false, &block) | |
if no_gc | |
GC.disable | |
else | |
GC.enable | |
# collect memory allocated during library loading | |
# and our own code before the measurement |
--- | |
- \w*aclit\w* | |
- \w*adick\w* | |
- \w*aids\w* | |
- \w*alabama porch monkey\w* | |
- \w*anal intruder\w* | |
- \w*anal invader\w* | |
- \w*analicker\w* | |
- \w*anus\w* | |
- \w*4r5e\w* |
Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Moby VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).
docker run -it --rm --privileged --pid=host justincormack/nsenter1
more info: https://github.com/justincormack/nsenter1
// The polling function | |
function poll(fn, timeout, interval) { | |
var endTime = Number(new Date()) + (timeout || 2000); | |
interval = interval || 100; | |
var checkCondition = function(resolve, reject) { | |
var ajax = fn(); | |
// dive into the ajax promise | |
ajax.then( function(response){ | |
// If the condition is met, we're done! |
WITH table_scans as ( | |
SELECT relid, | |
tables.idx_scan + tables.seq_scan as all_scans, | |
( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes, | |
pg_relation_size(relid) as table_size | |
FROM pg_stat_user_tables as tables | |
), | |
all_writes as ( | |
SELECT sum(writes) as total_writes | |
FROM table_scans |