Skip to content

Instantly share code, notes, and snippets.

View mhenrixon's full-sized avatar
🐢
I may be slow to respond.

Mikael Henriksson mhenrixon

🐢
I may be slow to respond.
View GitHub Profile
@mhenrixon
mhenrixon / docker-compose.yml
Created March 23, 2017 10:33 — forked from mdub/docker-compose.yml
How to share a /usr/local/bundle cache between Ruby build jobs
version: "2"
services:
dev:
image: ruby:2.3
volumes:
- .:/project
- ruby2.3-bundle-cache:/usr/local/bundle
working_dir: /project
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
@mhenrixon
mhenrixon / .travis.yml
Created September 9, 2016 07:46
How to push coverage to code climate from travis-ci when running rspec from docker-compose
sudo: required
language: ruby
services:
- docker
script:
- docker-compose run -e TRAVIS=$TRAVIS -e TRAVIS_BRANCH=$TRAVIS_BRANCH -e TRAVIS_JOB_ID=$TRAVIS_JOB_ID -e TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST rspec
- docker-compose run -e TRAVIS=$TRAVIS -e TRAVIS_BRANCH=$TRAVIS_BRANCH -e TRAVIS_JOB_ID=$TRAVIS_JOB_ID -e TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST test_app
@mhenrixon
mhenrixon / after.txt
Created August 20, 2015 11:57
A comparison of before and after optimizing for memory usage and performance.
Total allocated: 526174 bytes (9496 objects)
Total retained: 680 bytes (17 objects)
allocated memory by gem
-----------------------------------
526174 wodconnect/app
allocated memory by file
-----------------------------------
152252 /Users/mhenrixon/code/kiskolabs/wodconnect/app/models/bill.rb
@mhenrixon
mhenrixon / DiagnostigsReport.log
Last active August 29, 2015 14:27
let_it_go crash reports
Process: ruby [19993]
Path: /Users/USER/*/ruby
Identifier: ruby
Version: 0
Code Type: X86-64 (Native)
Parent Process: zsh [14987]
Responsible: iTerm2 [11084]
User ID: 501
Date/Time: 2015-08-18 13:55:44.681 +0200
@mhenrixon
mhenrixon / circle.yml
Last active August 29, 2015 14:23 — forked from jwaldrip/circle.yml
machine:
services:
- 'postgresql'
- 'redis'
environment:
REDIS_URL: 'redis://localhost:6379/0'
dependencies:
pre:
- 'git config user.email deploy+$CIRCLE_USERNAME@brandfolder.com'
- 'git config user.name $CIRCLE_USERNAME'

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
# Public: Stubs partial search
# Examples =>
# stub_partial_search(:node, 'name:web*').and_return([{ 'fqdn' => 'web01.example.com' }])
#
def stub_partial_search(type, query)
allow(Chef).to receive(:partial_search).and_call_original
expect(Chef).to receive(:partial_search).with(type, query, any_args)
end
@mhenrixon
mhenrixon / 0_reuse_code.js
Last active August 29, 2015 14:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mhenrixon
mhenrixon / add_missing_newline.sh
Created April 22, 2014 09:44
Recursively adds newline to the end of every file with the .rb extension
for file in **/*.rb; do
[ -e "$file" ] || continue
if [[ -n "$(tail -c 1 <"$file")" ]]; then
echo >> "$file"
fi;
done