Skip to content

Instantly share code, notes, and snippets.


Thijs van der Vossen tvandervossen

View GitHub Profile
View map_to_list.rb
'c' => 'coin',
'w' => 'wall'
def map_to_list(map)
list = []
map.strip!.gsub!(/\n\s*/, "\n")
View vector_to_coordinates.rb
def vector_to_coordinates(distance, angle_in_degrees)
angle_in_radians = angle_in_degrees * Math::PI / 180
x = (distance * Math.cos(angle_in_radians)).round
y = (distance * Math.sin(angle_in_radians)).round
[x, y]
require "test/unit"
class TestVectorConversion < Test::Unit::TestCase
View LinnStrument.control.js
host.defineController("Roger Linn Design", "LinnStrument", "1.0", "B7DD06CB-63BA-4902-879E-050B09D3058F");
host.defineMidiPorts(1, 1);
host.addDeviceNameBasedDiscoveryPair(["LinnStrument MIDI"], ["LinnStrument MIDI"]);
function init()
View tilt.js
// On iPhone and iPod Touch we add a nice dynamic 3D parallax effect by
// updating the perspective origin depending on device tilt.
if (/iPhone|iPod/.test(navigator.platform) && 'ondevicemotion' in window) {
;(function() {
var value,
element = $('div.doors ul').get(0),
values = {x: [0,0,0], y: [0,0,0]}, // Keep the 3 most recent values.
index = 0,
choices = { // Lookup table to normalize based on device orientation.
x: {'0': ['x', -1], '90': ['y', 1], '180': ['x', 1], '-90': ['y', -1]},
tvandervossen /
Last active May 5, 2018
Quick guide for people who want to add stimulus.js to a Rails 5.2 app but who haven’t used much Modern JavaScript

How to add stimulus.js to a Rails 5.2 app

This might also work or Rails 5.1, but I haven’t tried that yet.

Add the webpacker gem to your Gemfile:

# Transpile app-like JavaScript. Read more:
gem 'webpacker'

Then run (assuming you’re on macOS and using Homebrew):

tvandervossen /
Created Apr 11, 2018
Quick guide to add stimulus.js to a Rails 5.2 app if you haven’t used much Modern ™ JavaScript before

Add stimulus.js to a Rails 5.2 app

According to you should:

Add the webpacker gem to your Gemfile:

# Transpile app-like JavaScript. Read more:
gem 'webpacker'

Then run (assuming you’re on macOS and using Homebrew):

tvandervossen / gist:50897e4c0ad40b162b033da1f17b7867
Created Mar 10, 2018
Trying to understand the motivation behind the BEM class naming convention
View gist:50897e4c0ad40b162b033da1f17b7867
In the following CSS is given as an exampke:
/* Block component */
.btn {}
/* Element that depends upon the block */
.btn__price {}
/* Modifier that changes the style of the block */
.btn--orange {}
tvandervossen / read_any_encoding.rb
Created May 22, 2017
Read and convert any text file to UTF-8 in Ruby
View read_any_encoding.rb
require 'tedrahcu'
data = IO.binread(path)
encoding = Tedrahcu.detect(data)
data.force_encoding(encoding).encode!('UTF-8', invalid: :replace, undef: :replace, replace: '', universal_newline: true)

Ons Medicatiecontrole versie 0.9.1

Controleverzoeken worden nu bij voorkeur aan collega’s binnen je team toegewezen.

Daarnaast zijn er een aantal verbeteringen gedaan aan de performance en stabiliteit. Daarnaast zijn de volgende specifieke problemen verholpen:

  • Op sommige apparaten kwam de preview bij het maken van de foto niet helemaal overeen met de uiteindelijk gemaakte foto. Dit probleem is verholpen, de preview bij het maken van een foto zou nu ook altijd vierkant moeten zijn.
  • Bij het bekijken van een controle in het dossier van de client op Internet Explorer 11 werden de foto’s niet weergegeven. Dit zou nu ook in Internet Explorer 11 moeten werken.
  • Na het updaten of opnieuw installeren neemt de app nu de huidige beschikbaarheid over van de server.
View Books for design and development students
Mindset: The New Psychology of Success - Carol Dweck
Test Driven Development: By Example - Kent Beck
Implementation Patterns - Kent Beck
Wim Crouwel in his own words (
Don't Make Me Think, Revisited: A Common Sense Approach to Web Usability - Steve Krug
Badass: Making Users Awesome - Kathy Sierra
Thinking with Type: A Critical Guide for Designers, Writers, Editors, & Students - Ellen Lupton
The Vignelli Canon - Massimo Vignelli (
Stop Stealing Sheep & Find Out How Type Works - Erik Spiekermann, E.M Ginger
Mental Models - Indi Young
You can’t perform that action at this time.