This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# D subset |R Domain over which we integrate - sample D = [1,10] | |
D = (1..10).to_a | |
# f:|R->|R function - sample x |-> f(x) := x^2 | |
f = lambda {|x| x*x} | |
# summation of function values over our domain | |
summator = lambda {|function, domain| domain.inject(0){|x,y| x += function.call(y)} } | |
# Integrations Driver (for real valued 1d functions only) - assumption: integration steps equidistant |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# given class Computer: refactor me | |
class Computer | |
def initialize(computer_id, data_source) | |
@id = computer_id | |
@data_source = data_source | |
end | |
def mouse | |
info = @data_source.get_mouse_info(@id) | |
price = @data_source.get_mouse_price(@id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lambda { | |
setups = [] | |
events = {} | |
Kernel.send :define_method, :event do |name, &block| | |
events[name] = block | |
end | |
Kernel.send :define_method, :setup do |&block| | |
setups << block | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Checkboxes | |
- [x] A | |
- [x] B | |
- [x] C | |
~~Durchgestrichen~~ | |
FooImage | |
 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# map two lists: e.g sum elementwise | |
[1,2,3].zip([4,5,6]).map{|a,b| a+b} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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...) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% gives a gaussain kernel of size (dim_n x dim_x) having a variance equal to sigma_value. | |
fspecial('gaussian', dim_n, sigma_value) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% 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 |
OlderNewer