Skip to content

Instantly share code, notes, and snippets.

View batsify's full-sized avatar

Batsify batsify

View GitHub Profile

Running long jobs on remote machine with docker-machine

Use the -d flag with run command.

EG:

eval $(docker-machine env feature)
docker-compose -f delivery.docker-compose.yml run -d rails rake db:seed
@batsify
batsify / es5.1-supermethod.js
Last active April 22, 2016 10:21
How use super like in OOP with a Prototypal Language
// How use super like in OOP with a Prototypal Language :
!function(){
'use strict';
console.log("Starting");
var Feline = function(name, race) {
if ( !(this instanceof Feline) ) return;
this.name = name;
this.race = race || "Feline"
console.log("Feline DNA new say : A new " + this.race + " is born : " + this.name);
@batsify
batsify / reflection.go
Created April 8, 2016 19:05 — forked from drewolson/reflection.go
Golang Reflection Example
package main
import (
"fmt"
"reflect"
)
type Foo struct {
FirstName string `tag_name:"tag 1"`
LastName string `tag_name:"tag 2"`
@batsify
batsify / exercise.tour.go
Created March 17, 2016 12:48 — forked from zyxar/exercise.tour.go
tour.golang exercise solutions
/* Exercise: Loops and Functions #43 */
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := float64(2.)
@batsify
batsify / ruby-destructor-example.rb
Created March 8, 2016 10:27 — forked from iboard/ruby-destructor-example.rb
Ruby 'Destructor' example.
class Foo
attr_reader :bar
def initialize
@bar = 123
ObjectSpace.define_finalizer( self, self.class.finalize(bar) )
end
def self.finalize(bar)
proc { puts "DESTROY OBJECT #{bar}" }
end
@batsify
batsify / GoMgoSample-1.go
Created February 3, 2016 08:06 — forked from ardan-bkennedy/GoMgoSample-1.go
Sample Go and MGO example
type (
// BuoyCondition contains information for an individual station.
BuoyCondition struct {
WindSpeed float64 `bson:"wind_speed_milehour"`
WindDirection int `bson:"wind_direction_degnorth"`
WindGust float64 `bson:"gust_wind_speed_milehour"`
}
// BuoyLocation contains the buoy's location.
BuoyLocation struct {
@batsify
batsify / generate_archives.rb
Created October 29, 2015 13:02 — forked from stympy/generate_archives.rb
Archive generator plugin for jekyll
# Jekyll archive page generator with pagination.
#
# Based on the category generator from
# http://recursive-design.com/projects/jekyll-plugins/,
# which is copyright (c) 2010 Dave Perrett,
# http://recursive-design.com/ and is licensed under the MIT
# license (http://www.opensource.org/licenses/mit-license.php), and
# on the pagination code from Jekyll itself.
#
# This code is copyright (c) 2011 Benjamin Curtis, and is licensed
@batsify
batsify / tmux.md
Last active September 11, 2015 08:35 — forked from andreyvit/tmux.md
tmux cheatsheet

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

@batsify
batsify / tmux_cheatsheet.markdown
Last active September 7, 2015 09:05 — forked from henrik/tmux_cheatsheet.markdown
tmux cheatsheet

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@batsify
batsify / tmux-cheatsheet.markdown
Last active September 7, 2015 09:01 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname