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
module Group where

import List.Extra exposing (span)

countingGroupBy : (a -> b) -> List a -> List (b, Int)
countingGroupBy key xs' =
  let
    eq a b = key a == key b
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');
@cowboymathu
cowboymathu / touchcursor_mode.json
Created September 8, 2017 20:36
TouchCursor Karabiner-Elements json
{
"title": "TouchCursor Mode",
"rules": [
{
"description": "TouchCursor Mode [Space as Trigger Key]",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "spacebar",
@nachoab
nachoab / serverless-auth-extension-plugin
Created October 3, 2016 21:30
adds the posibility to configure AWS_IAM and "Invoke with caller credentials" for your API Gateway endpoints
'use strict';
/**
* Adds the posibility to configure AWS_IAM for your API Gateway endpoints
* and "Invoke with caller credentials"
*
* Usage:
*
* myFuncGetItem:
/**
* Knockout.js extension that gives both new and old value to
* subscription functions.
*
* Credit: http://stackoverflow.com/a/18184016/204610
*
* Changed JBeagle's code to return a disposable subscription
* object so it conforms to subscribe()
*/
ko.subscribable.fn.subscribeChanged = function (callback) {
function * just (...values) {
yield * values;
};
function first (iterable) {
const iterator = iterable[Symbol.iterator]();
const { done, value } = iterator.next();
if (!done) return value;
};
@tcrowe
tcrowe / src-middleware-authenticated.js
Created September 13, 2019 20:45
express, sapper, polka authentication idea
/*
+ assuming you're using cookie-session or similar session
usage:
import authenticated from "./middleware/authenticated.js"
server.use(authenticated)
*/
@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));
};
" netrw
let g:netrw_banner = 0 " hide banner
let g:netrw_altv=1 " open splits to the right
let g:netrw_liststyle=3 " tree view
let g:netrw_list_hide=netrw_gitignore#Hide()
function! s:open_netrw()
" Grab the current file name
let file_name = expand("%:t")
" Open a 20-column left-side netrw explorer in the directory for the current
@SunboX
SunboX / inlineworker.js
Created June 24, 2013 12:21
Create web workers without a separate worker JS files. Source: http://jsbin.com/owogib/8/
function worker() {
setInterval(function() {
postMessage({foo: "bar"});
}, 1000);
}
var code = worker.toString();
code = code.substring(code.indexOf("{")+1, code.lastIndexOf("}"));
var blob = new Blob([code], {type: "application/javascript"});