Skip to content

Instantly share code, notes, and snippets.

View mokkabonna's full-sized avatar

Martin Hansen mokkabonna

  • Knowit Amende AS
  • Oslo, Norway
View GitHub Profile
@mokkabonna
mokkabonna / gist:301e53b19e726fb9dd7e
Last active August 29, 2015 14:02
sinon shorter stack errors, add in assert.fail
fail: function fail(message) {
var error = new Error(message);
error.name = this.failException || assert.failException;
try{
throw error;
} catch(e) {
if (error.stack){
console.log(error.stack);
error.stack = error.stack.split('\n').slice(0,20).join('\n')
{
"adresse": "MARIDALSVEIEN 2",
"tiltak": {
"beslutningsTre": {
"id": "5",
"label": "Tiltaksliste ved bevaringsverdig eiendom",
"multipleSelect": true,
"beslutninger": [{
"id": "6",
"label": "Bytte vindu eller dør",
@mokkabonna
mokkabonna / json_merge.coffee
Last active March 26, 2020 12:47 — forked from jphaas/json_merge.coffee
json auto merge
#To install:
#
#Requires coffe script installed globally: sudo npm install -g coffee-script
#
#In your git configuration (for instance, .git/config to do it at the project level), add:
#
#[merge "json_merge"]
# name = A custom merge driver for json files
# driver = coffee json_merge.coffee %O %A %B
# recursive = binary
sudo apt-get install --no-install-recommends mutter
mutter --replace
Section "ServerLayout"
Identifier "layout"
Screen 0 "nvidia"
Inactive "intel"
EndSection
Section "Device"
Identifier "intel"
Driver "intel"
BusID "PCI:0@0:2:0"
update-alternatives: using /usr/lib/nvidia-349-prime/ld.so.conf to provide /etc/ld.so.conf.d/x86_64-linux-gnu_GL.conf (x86_64-linux-gnu_gl_conf) in manual mode
update-alternatives: using /usr/lib/nvidia-349-prime/alt_ld.so.conf to provide /etc/ld.so.conf.d/i386-linux-gnu_GL.conf (i386-linux-gnu_gl_conf) in manual mode
# Atom Beautify - Debugging information
The following debugging information was generated by `Atom Beautify` on `Fri Dec 01 2017 14:25:19 GMT+0100 (Vest-Europa (normaltid))`.
---
## Table Of Contents
- [Versions](#versions)
- [Original file to be beautified](#original-file-to-be-beautified)
- [Original File Contents](#original-file-contents)
@mokkabonna
mokkabonna / add-1-binary.js
Last active October 23, 2019 12:49
Add 1 binary, no if in program, besides the inherent if in biwise operators. stream compatible
// add 1 to any binary number, left aligned, to support streaming
var numbers = Array(20)
.fill(0)
.map((n, i) => i
.toString(2)
.split('')
.reverse()
)
console.log(numbers)
s: 011001 22
a: 010000 2
r: 000101 24
t: 011101
0011000010, 2 width
take any while second is 0, data is first
when 1 then create operation bits, add 1 bit, then do &
0