Skip to content

Instantly share code, notes, and snippets.

View adamrenklint's full-sized avatar

Adam Renklint adamrenklint

View GitHub Profile
@adamrenklint
adamrenklint / ExampleController.coffee
Last active December 17, 2015 20:19
Simple mixin to glue together a controller and view presenter example for Backbone. The view is modified to not handle DOM events on its own, but offer a public interface (replacing the old events hash) for decoupled wiring with controller.
define 'ExampleController', ->
class
# Save a reference to the view
constructor: (@view) ->
# Hook our method up to the view event
implements:
'click:logo': 'clickLogo'
@adamrenklint
adamrenklint / gist:9713653
Created March 22, 2014 20:20
Get line count from files
find . -name '*.js' | xargs wc -l
@adamrenklint
adamrenklint / pre-commit
Created April 12, 2014 09:30
Pre commit hook for cam shot
#!/usr/bin/env ruby
file="~/.gitshots/#{Time.now.to_i}.jpg"
unless File.directory?(File.expand_path("../../rebase-merge", __FILE__))
puts "Taking capture into #{file}!"
system "imagesnap -q -w 3 #{file} &"
end
exit 0
@adamrenklint
adamrenklint / list-select.html
Created October 16, 2014 09:22
Advanced indexed content insertion points with fallback
<wunderland-component attributes="name value values options type prefix_nodes">
<template>
<template repeat="{{val, i in values}}">
<div class="prefix_insertion" id="{{i | attach_prefix_node}}"></div>
<wunderland-select on-change="{{updateValue}}">
<template repeat="{{opt in options}}">
<wunderland-option selected="{{opt == val}}">{{opt}}</wunderland-option>
</template>
</wunderland-select>
<wunderland-button class="remove" context="danger" on-click="{{removeOption}}" index="{{i}}" size="small">Remove</wunderland-button>
http://www.trn.gl/bhkr
INDEX/KEY/POSITION
/QFQ(FQ_Q)FS*
0 1Q 1.1.01
1 1F 1.1.49
2 1Q 1.2.01
4 1F 1.2.49
import { combineReducers } from 'redux';
function user(state = {}, action) {
switch (action.type) {
case UPDATE_USERNAME:
return {
...state,
name: action.payload
};
}
@adamrenklint
adamrenklint / progress.js
Last active June 3, 2016 08:11
Drawing a progress bar from Dilla's position
var Dilla = require('./index');
var audioContext = new (window.AudioContext || window.webkitAudioContext)();
var dilla = new Dilla(audioContext);
// Setup the standard metronome stuff
var high = {
'position': '*.1.01',
'freq': 440,
'duration': 15
};
@adamrenklint
adamrenklint / vanilla-1.ts
Created September 16, 2016 13:22
Immutable data structures in TypeScript
import { freeze, assoc } from 'icepick'
interface User {
/**
* Name of the user
*/
readonly name: string
/**
* Age of the user
*/
@adamrenklint
adamrenklint / emacs-cheat-sheet.md
Created October 13, 2016 14:14 — forked from dherman/emacs-cheat-sheet.md
Emacs cheat sheet

Rule of thumb: when in doubt, C-g it out.

Basics (mandatory)

You simply can't get by without having these at your fingertips.

  • C-x C-c - quit
  • C-x C-s - save buffer
  • C-x C-f - open file
  • C-x b buffer name - switch to open buffer
@adamrenklint
adamrenklint / tmux.md
Created October 14, 2016 13:32 — 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