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
fnky / proposal-for-memberwise-initializers.swift
Last active August 29, 2015 14:13
Proposal for Memberwise Initializers with Optional Arguments and Default Values
/*
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
fnky / Math.md
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
fnky / content.html
Created March 14, 2015 15:55
Simple container max-width
<div class="container"></div>
@fnky
fnky / gulpfile.coffee
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
fnky / README.md
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 com.apple.PowerChime ChimeOnAllHardware -bool true; open /System/Library/CoreServices/PowerChime.app &

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

@fnky
fnky / BOOKMARK.md
Created August 8, 2015 17:07
My bookmarks in a gist
@fnky
fnky / .gitconfig
Last active November 5, 2015 02:36
git config
[hub]
protocol = https
[user]
name = Christian Petersen
email = humanoidism@gmail.com
[credential]
helper = osxkeychain
@fnky
fnky / keybase.md
Created January 5, 2016 16:03
Keybase proof

Keybase proof

I hereby claim:

  • I am fnky on github.
  • I am cbp (https://keybase.io/cbp) on keybase.
  • I have a public key ASAoy43ZvKjh6P7JlU6DtqF-aWhwh5Ywcrzh4Fx_M77H3Ao

To claim this, I am signing this object:

@fnky
fnky / example.js
Last active June 30, 2016 07:25
Buffer being wrong?
'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
fnky / WAD3.bt
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
//------------------------------------------------