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 / promise-serial.js
Last active January 24, 2018 08:22
Promise utilities
import Promise from 'bluebird'
Promise.serial = (input, initialPromise) =>
Promise.reduce(
input,
(previousResult, fn) => fn(previousResult),
initialPromise
);
Promise.prototype.serial = function serial(input) {
@fnky
fnky / rust-resources.md
Last active November 7, 2017 08:46
Rust Resources
@fnky
fnky / promise-tuple.js
Last active December 18, 2023 19:54
Retrieve tuples from Promise results / async functions
/**
* Returns a Promise which resolves with a value in form of a tuple.
* @param promiseFn A Promise to resolve as a tuple.
* @returns Promise A Promise which resolves to a tuple of [error, ...results]
*/
export function tuple (promise) {
return promise
.then((...results) => [null, ...results])
.catch(error => [error])
}
#include "angelscript.h"
#include "extdll.h"
#include "util.h"
#include "CASDocumentation.h"
#include "CString.h"
#include "ASEngine.h"
@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
//------------------------------------------------
@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 / 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 / .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 / BOOKMARK.md
Created August 8, 2015 17:07
My bookmarks in a gist
@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.