Skip to content

Instantly share code, notes, and snippets.

View kennethgeerts's full-sized avatar
🏠
Working from home

Kenneth Geerts kennethgeerts

🏠
Working from home
View GitHub Profile
- copy .ssh and .zshrc
- install app store apps
- curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
- ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
- brew tap phinze/cask
- brew tap caskroom/versions
- brew install apgdiff brew-cask elasticsearch gd git gnuplot heroku-toolbelt jmeter leiningen libpng libyaml maven openssl pkg-config rbenv ruby-build unrar watch wget youtube-dl
tell application "Mail"
set theSubject to "Clean me up!"
set theContent to "Nothing interesting here..."
set theAddress to "cleanup.secs@mail.ci.apps.up-nxt.com"
set theAttachmentFile to "Macintosh HD:Users:kenneth:Dropbox:contact.jpg"
set msg to make new outgoing message with properties {subject: theSubject, content: theContent, visible:true}
tell msg to make new to recipient at end of every to recipient with properties {address:theAddress}
POPULATION_SIZE = 24
NUM_BITS = 64
NUM_GENERATIONS = 1000
CROSSOVER_RATE = 0.7
MUTATION_RATE = 0.001
class Chromosome
attr_accessor :genes
@kennethgeerts
kennethgeerts / Preferences.sublime-settings
Created April 22, 2014 12:45
Preferences.sublime-settings
{
"auto_complete_commit_on_tab": true,
"caret_style": "solid",
"color_scheme": "Packages/RailsCasts Colour Scheme/RailsCastsColorScheme.tmTheme",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
"*.pyc",
"*.pyo",
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# Usage:
# Remove the .sh file extension when you put the script in your hooks folder!
#
def search_field(field, operator, attributes = {})
field_op = "#{field}_#{operator}"
value = (params[:q][field_op] if params[:q])
title = t(".#{field_op}")
label_tag = content_tag :label, title
attributes[:name] = "q[#{field_op}]"
attributes[:type] ||= 'text'
attributes[:value] = value
input_tag = content_tag :input, nil, attributes
[label_tag, input_tag].join.html_safe
@kennethgeerts
kennethgeerts / en.yml
Created October 16, 2014 14:05
en.yml
en:
hello: "Hello world"
activemodel:
models:
record: Record
user: User
attributes:
record:
customer_id: Customer ID
name: Customer Name
def document_actions_form_tag
capture do
concat form_tag('', method: :post, id: 'document_actions_form')
input_name_value_pairs(request.params).each do |name_value_pair|
concat tag('input', { name: name_value_pair.first, value: name_value_pair.last, type: 'hidden' })
end
clazz = Class.new do
def checkbox_header
@kennethgeerts
kennethgeerts / recursion.rb
Created February 17, 2015 11:23
recursion
require 'benchmark'
class Integer
def performant_factorial
(1..self).reduce(:*) || 1
end
def recursive_factorial
self == 0 ? 1 : self * (self - 1).recursive_factorial
end
class FoodChain
VERSION = 2
def self.song
0.upto(7).map { |n| FoodChainStanza.nth(n) }.join("\n")
end
end
class FoodChainStanza
ANIMALS = %w(fly spider bird cat dog goat cow horse)