Skip to content

Instantly share code, notes, and snippets.

View mblarsen's full-sized avatar
💭
Actively recommending people not to use WordPress!

Michael Bøcker-Larsen mblarsen

💭
Actively recommending people not to use WordPress!
View GitHub Profile
uploadMethod: 'PUT',
uploadAdded: function(file, item) {
//Recieve the signed PUT request here
//I can create another GIST if anyone would like the code for signing the requests
mydropzone.options.url = url;
},
uploadSending: function(file, formData, xhr) {
xhr.setRequestHeader('Content-Type', file.type || 'application/octet-stream');
@samgiles
samgiles / flatMap.js
Created June 20, 2014 11:32
Javascript flatMap implementation
// [B](f: (A) ⇒ [B]): [B] ; Although the types in the arrays aren't strict (:
Array.prototype.flatMap = function(lambda) {
return Array.prototype.concat.apply([], this.map(lambda));
};
@staltz
staltz / introrx.md
Last active May 3, 2024 13:00
The introduction to Reactive Programming you've been missing
package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)
@jirutka
jirutka / pg_change_db_owner.sh
Last active February 6, 2024 20:01
Some convenient scripts to manage ownerships and privileges in PostgreSQL.
#!/bin/sh
#
# The MIT License
#
# Copyright 2014-2017 Jakub Jirutka <jakub@jirutka.cz>.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@vsouza
vsouza / .bashrc
Last active April 9, 2024 05:27
Golang setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell, fish or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active April 13, 2024 16:19
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
"Chuck this in [a vim runtime]/nerdtree_plugin/gitignore_filter.vim
if exists("loaded_nerdtree_gitignore_filter")
finish
endif
let loaded_nerdtree_gitignore_filter = 1
call NERDTreeAddPathFilter('NERDTreeGitIgnoreFilter')
@kus
kus / fixIOSAudioContext.js
Last active March 27, 2024 11:21
Fix iOS AudioContext on Safari not playing any audio. It needs to be "warmed up" from a user interaction, then you can play audio with it as normal throughout the rest of the life cycle of the page.
// Fix iOS Audio Context by Blake Kus https://gist.github.com/kus/3f01d60569eeadefe3a1
// MIT license
(function() {
window.AudioContext = window.AudioContext || window.webkitAudioContext;
if (window.AudioContext) {
window.audioContext = new window.AudioContext();
}
var fixAudioContext = function (e) {
if (window.audioContext) {
// Create empty buffer
@bahmutov
bahmutov / Docker shell commands.sh
Last active February 9, 2024 07:55
A personal cheat sheet for running local Node project in a Docker container
# See list of docker virtual machines on the local box
$ docker-machine ls
NAME ACTIVE URL STATE URL SWARM DOCKER ERRORS
default * virtualbox Running tcp://192.168.99.100:2376 v1.9.1
# Note the host URL 192.168.99.100 - it will be used later!
# Build an image from current folder under given image name
$ docker build -t gleb/demo-app .