Skip to content

Instantly share code, notes, and snippets.


Zidni Mubarock barockok

View GitHub Profile
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:


start new with session name:

tmux new -s myname
View capybara cheat sheet
=Clicking links and buttons=
click_link('Link Text')
click('Link Text') # Click either a link or a button
click('Button Value')
danharper / gulpfile.js
Last active Jul 30, 2020
New ES6 project with Babel, Browserify & Gulp
View gulpfile.js
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
jacqui / gist:983051
Created May 20, 2011 — forked from pauldix/gist:981916
Redis SORT command examples
View gist:983051
# Optimized for writes, sort on read
redis.hset("bonds|1", "bid_price", 96.01)
redis.hset("bonds|1", "ask_price", 97.53)
redis.hset("bonds|2", "bid_price", 95.50)
redis.hset("bonds|2", "ask_price", 98.25)
redis.sadd("bond_ids", 1)
redis.sadd("bond_ids", 2)
jirikuncar /
Last active Mar 14, 2020
Traefik - header matching

Traefik routing

Proxy to services based on Accept header.


docker-compose up -d


View gist:3444459
# no config is localtime
1.second.from_now is UTC
Timestamp stored in UTC
AR not translated Fri Aug 24 10:22:25 +0930 2012
1.second.from_now 2012-08-24 00:52:26 UTC
d11wtq / let.js
Created Aug 18, 2012
RSpec style let() in Jasmine/Mocha
View let.js
* Get RSpec-style let() in your Mocha/Jasmine specs.
var let = function (callback) {
var value, called = false;
var memoizer = function() {
if (called) {
return value;
} else {
called = true;
jasoncodes / create_item_children_count.rb
Created Oct 23, 2011
Create ActiveRecord models for database views
View create_item_children_count.rb
class CreateItemChildrenCountView < ActiveRecord::Migration
def self.up
execute <<-SQL
CREATE VIEW item_children_count AS
SELECT parent_id AS item_id, COUNT(*) as children_count
FROM items GROUP BY parent_id;
def self.down
linjian / deferred_garbage_collection_all_in_one.rb
Created Jul 19, 2012
Deferred Garbage Collection All in One
View deferred_garbage_collection_all_in_one.rb
# Usage:
# DEFER_GC=10 rspec spec/
# DEFER_GC=10 cucumber features/
# put it to spec/support/deferred_garbage_collection_all_in_one.rb
# or feature/support/hooks.rb
class DeferredGarbageCollection
alieseparker / Floyd-Warshall
Last active Jan 1, 2018
Floyd-Warshall - Find shortest path
View Floyd-Warshall
# Floyd-Warshall Algorithm
## Introduction:
Finds Shortest Path (or longest path) among all pairs of nodes in a graph.
Complexity: O(|n|³)
## How does it work?
- There can be more than one route between two nodes.
- The number of nodes in the route isn’t important (Path 4 has 4 nodes but is shorter than Path 2, which has 3 nodes)
- There can be more than one path of minimal length
You can’t perform that action at this time.