Skip to content

Instantly share code, notes, and snippets.

View fnky's full-sized avatar
TypeError: Cannot read property 'status' of undefined.

Christian Petersen fnky

TypeError: Cannot read property 'status' of undefined.
View GitHub Profile
fnky / proposal-for-memberwise-initializers.swift
Last active August 29, 2015 14:13
Proposal for Memberwise Initializers with Optional Arguments and Default Values
View proposal-for-memberwise-initializers.swift
Memberwise Initializers with Optional Arguments and Default Values
This playground explains a proposal to enhance the use of the great
feature; member variables. To extend the possibilities of the Swift
language and still keep it simple enough to understand.
Member initializers are a great addition, and helps scaffolding
structures, without doing initial boilerplate code. It works well,
but there's some differences when it comes to Optional types and
fnky /
Created January 10, 2015 02:24
Math Equations for Designers

Math Equations for Designers

This is a collection of mathmatic equations that has helped me in a variety of design projects.

Calculate the size of an area, given the amount of objects and their sizes

Given the amount of objects, and their width or height (e.g. in pixels) we can calculate the width or height of an area that these objects fit in.

fnky / content.html
Created March 14, 2015 15:55
Simple container max-width
View content.html
<div class="container"></div>
fnky /
Last active August 29, 2015 14:19
Resize retina files to normal with gulp
gulp = require('gulp')
newer = require('gulp-newer')
unretina = require('gulp-unretina')
rename = require('gulp-rename')
# Transforms the path from e.g. asset_2x.png to asset.png
# @param {String} suffix The suffix to remove
transformPath = (suffix) ->
fnky /
Last active June 21, 2023 16:50
Activate the power chime sound effect. For MacBook Pro and MacBook Air

Power Chime

To activate the sound effect

$ defaults write ChimeOnAllHardware -bool true; open /System/Library/CoreServices/ &

Do deactivate it, simply change the ChimeOnAllHardware boolean to false.

fnky /
Created August 8, 2015 17:07
My bookmarks in a gist
fnky / .gitconfig
Last active November 5, 2015 02:36
git config
View .gitconfig
protocol = https
name = Christian Petersen
email =
helper = osxkeychain
fnky /
Created January 5, 2016 16:03
Keybase proof

Keybase proof

I hereby claim:

  • I am fnky on github.
  • I am cbp ( on keybase.
  • I have a public key ASAoy43ZvKjh6P7JlU6DtqF-aWhwh5Ywcrzh4Fx_M77H3Ao

To claim this, I am signing this object:

fnky / example.js
Last active June 30, 2016 07:25
Buffer being wrong?
View example.js
'use strict'
const chr = (codePoint) => String.fromCharCode(codePoint)
function bin2hex (s) {
let o = ''
for (let i = 0, l = s.length; i < l; i++) {
let n = s.charCodeAt(i).toString(16)
o += (n.length < 2 ? '0' + n : n)
fnky /
Last active January 10, 2017 20:54
010 Editor Template for Parsing Half-Life WAD3
//--- 010 Editor v7.0.2 Binary Template
// File: WAD3
// Authors: @fnky
// Purpose: Parsing Half-Life WAD3 File
// Category: Archive
// File Mask: *.wad
// ID Bytes: 57 41 44 33, 57 41 44 32