Skip to content

Instantly share code, notes, and snippets.

Avatar

Henric Trotzig trotzig

View GitHub Profile
@trotzig
trotzig / Byte abuse
Last active Aug 29, 2015
This story was posted to leaveastory.com on March 8, 2014.
View Byte abuse
It wasn't the first time I had woken up in the middle of the night thinking about it. To be honest, I'd been sleeping terribly for over a week. All I could think of was to have it. Just a small fix, and then I'd go back to sleep. I know it wasn't healthy, but I couldn't do anything about it. In my mind, it wasn't a physical addiction. My body just needed it.
The kitchen was dark apart from a light that I'd intentionally left on before going to bed. Traces of previous sessions were scattered over the kitchen table. Soda cans and empty energy bar packages took up most of the space. I had come to understand that by adding lots of energy in the form of sugar I was able to sustain the effect a lot longer than I would have without the carbohydrates.
The first part of a session, which I called "the prep phase", included ssh-ing into a virtual cluster hosted on a remote island outside the coast of The Phillipines. You might call this "early tripping", but for me it was a means to an end, not the actual thing. What
@trotzig
trotzig / face_pile_positions_csv2css.rb
Last active Aug 29, 2015
Conversion script for Face Pile positions
View face_pile_positions_csv2css.rb
require 'csv'
# Script used to convert the face pile positioning document Nebs put together in
# https://docs.google.com/a/causes.com/spreadsheets/d/1ELRK8J0I8Q-Hu8-mPIYvOxW0_cNDxvg35QNLzSrTIT8/edit
#
# I made a copy of this document and cleaned it to make it easier to parse:
# https://docs.google.com/a/causes.com/spreadsheets/d/1Ye2o-exOj1JsMPeeWiOk3s4HQ7UBtGlO1t2zSEUECbc/edit
# This is the document used in this script.
styles = {}
View contact-chip.html
<div class="chip">
<img class="chip__img" src="http://api.randomuser.me/portraits/med/women/56.jpg">
<div class="chip__info">
<h3 class="chip__info-name">Jane Doe</h3>
<div class="chip__info-email">jane.doe@brigade.com</div>
</div>
<button class="chip__action">×</button>
</div>
View contact-chip--floats.css
/**
* We need to clear floats for the container so that it wraps
* the content nicely.
*
* Clearfix technique from http://nicolasgallagher.com/micro-clearfix-hack/
*/
.chip:before,
.chip:after {
content: " ";
display: table;
View keybase.md

Keybase proof

I hereby claim:

  • I am trotzig on github.
  • I am henric (https://keybase.io/henric) on keybase.
  • I have a public key whose fingerprint is EC58 B9C8 9827 6856 7E00 B8A7 4C5B 3FD4 7166 FDEE

To claim this, I am signing this object:

@trotzig
trotzig / SassMeister-input-HTML.html
Created Oct 5, 2014
Generated by SassMeister.com.
View SassMeister-input-HTML.html
<div class="bike">
<div class="wheel wheel--front">
<div class="spoke spoke--0"></div>
<div class="spoke spoke--1"></div>
<div class="spoke spoke--2"></div>
<div class="spoke spoke--3"></div>
<div class="spoke spoke--4"></div>
</div>
<div class="wheel wheel--back">
<div class="spoke spoke--0"></div>
@trotzig
trotzig / SassMeister-input-HTML.html
Last active Aug 29, 2015
Generated by SassMeister.com.
View SassMeister-input-HTML.html
<div class="bike">
<div class="wheel wheel--front">
<div class="spoke spoke--0"></div>
<div class="spoke spoke--1"></div>
<div class="spoke spoke--2"></div>
<div class="spoke spoke--3"></div>
<div class="spoke spoke--4"></div>
</div>
<div class="wheel wheel--back">
<div class="spoke spoke--0"></div>
View unchain_vars.rb
# Converts global chained `var`s into single-line vars.
#
# Example:
#
# >> cat test.js
# var A = require('a'),
# B = require('b'),
# C = B.C;
#
# var D = function() {};
@trotzig
trotzig / subject-pattern.js.jsx
Last active Aug 29, 2015
An example of the `subject` pattern for DRYer Jasmine specs
View subject-pattern.js.jsx
describe('Button', () => {
beforeEach(() => {
this.subject = () => {
return React.addons.TestUtils.renderIntoDocument(
<Button {...this.props} />
);
};
});
describe('with a `text` prop', => {
View without-subject-pattern.js.jsx
describe('Button', () => {
describe('with a `text` prop', => {
it('renders the text', () => {
var button = React.addons.TestUtils.renderIntoDocument(
<Button text="Click me" />
);
expect(button).toHaveText('Click me');
});
describe('and an `icon` prop', () => {