Skip to content

Instantly share code, notes, and snippets.

@simplay
simplay / gist:9642897
Last active August 29, 2015 13:57
Github markdown cheatsheet
Checkboxes
- [x] A
- [x] B
- [x] C
~~Durchgestrichen~~
FooImage
![NAME](adresse/file.format)
@simplay
simplay / closure_example.js
Last active August 29, 2015 14:01
Example how to define a javascript class
// a sample class decleration showing javascript closure examples.
// Keep in mind: prototyped properties affect all objects of the
// same constructor, simultaneously, even if they already exist.
function Knight(hp){
// public attribute of Knight
this.hp = hp;
// private attribute of Knight
var secreteHP = hp+1;
@simplay
simplay / hof
Last active August 29, 2015 14:05
Higher order function examples.rb
# map two lists: e.g sum elementwise
[1,2,3].zip([4,5,6]).map{|a,b| a+b}
# reset local master
git fetch origin
git reset --hard origin/master
# show code diff of a COMMIT
git show COMMIT
# rabse last NUMBEROFCOMMITS commits (including head)
git rebase -i HEAD~NUMBEROFCOMMITS
@simplay
simplay / gist:981e7bf717baf0089712
Last active August 29, 2015 14:07
Fun Project Ideas
Ruby
Game of Life in Ruby - my old omnipresent friend <3
Collection of Sorting algorithms
Own DSL arrogating Matlab
SVM for higherdimensional classifiers
A general Ruby Convas (imagine it would directly make use of OpenGL...)
@simplay
simplay / Matlab cheatsheet
Created October 7, 2014 13:42
Matlab cheat-sheet
% gives a gaussain kernel of size (dim_n x dim_x) having a variance equal to sigma_value.
fspecial('gaussian', dim_n, sigma_value)
@simplay
simplay / brightnessCenter.m
Last active August 29, 2015 14:07
Brigthness center in image using a brightness threshold using image masking
% example determining brightness center from a given image A
% Args to provide: mask, image, threshold (perhaps).
% given a selection mask and image A like the following:
mask =
1 0 0 0
1 1 0 0
1 1 0 0
0 1 1 1

Find an assignment of the jobs to the machines such that total processing time is minimal.

Given bipartite Graph G = (V,E), determine its minimum weight matching:

1. Relabel edge weight of G: E' = {e' := e and e.w *= -1 | forall e in E}
2. Find minimum edge weight min_e in E'
3. E'' = {e'' := e' and e'.w += min_e | forall e' in E'}
4. Apply maximum weight matching problem to G = (V, E'')
# add a method that allows an object to add dyn. new instance methods.
module A
klass.instance_eval do
send(:attr_accessor, :observers)
instance_variable_set("@#{:observers}", [])
end
end
# including this object prepends a class' initializer
module B

rvm @webshop3 do gem list

rvm @global do gem install bundler -v=1.8.2