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
@mblarsen
mblarsen / toilet-demo.sh
Created October 24, 2020 07:40
Small script so showcase all fonts for figlet and toilet
#!/usr/bin/env bash
for f in $(ls /usr/share/figlet/*{flf,tlf}); do
f=$(basename -s .tlf $f)
f=$(basename -s .flf $f)
figlet -f $f $f
toilet --gay -S -f $f $f
echo $f
done
@mblarsen
mblarsen / zsh-fix-mv.sh
Last active May 14, 2019 03:17
zsh: fix command not found: _mv
rm -f ~/.zcompdump*
exec zsh -l
@mblarsen
mblarsen / example.go
Last active April 19, 2019 09:35
A small CLI wrapper + Go test wrapper for @serverless/event-mocks
func TestHandler(t *testing.T) {
req := api.Req{}
reqBody, _ := json.Marshal(map[string]interface{}{
"requestContext": map[string]interface{}{
"Authorizer": map[string]interface{}{
"claims": map[string]interface{}{
"cognito:username": "my user",
},
},
},
@mblarsen
mblarsen / test_match.sh
Created April 17, 2019 06:16
Query buildkit builds for changes since last
#!/usr/bin/env bash
set -euo pipefail
function builds() {
curl -s https://graphql.buildkite.com/v1 \
-H "Authorization: Bearer $GRAPHQL_KEY" \
-d '{
"query": "query SuccessfullBuilds { pipeline(slug: \"'"$BUILDKITE_ORGANIZATION_SLUG/$BUILDKITE_PIPELINE_SLUG"'\") { builds { edges { node { id commit message state } } } } }",
"variables": "{ }"
}'

Keybase proof

I hereby claim:

  • I am mblarsen on github.
  • I am mblarsen (https://keybase.io/mblarsen) on keybase.
  • I have a public key ASDazMiuoLmVqtEF123TAjZvE7S47WTshQTiHzeg1-H7lAo

To claim this, I am signing this object:

@mblarsen
mblarsen / array.js
Created March 1, 2018 02:50
Array.prototype extensions
Object.defineProperty( // eslint-disable-line
Array.prototype, 'flatMap', {
value: function (mapFunction) {
return Array.prototype.concat.call([], ...this.map(mapFunction))
}
}
)
Object.defineProperty( // eslint-disable-line
Array.prototype, 'tap', {
@mblarsen
mblarsen / SourceText.vue
Created November 13, 2017 06:48
Vue Editor Tutorial - Step 1 - SourceText.vue
<template>
<div class="source-text">
<div class="source-text__code" ref="content" @input="throttledUpdate" contenteditable="true" spellcheck="false"></div>
<div class="has-text-left">
<button @click="$emit('input', '')" class="button is-success">Clear</button>
</div>
</div>
</template>
<script>
import {debounce} from 'lodash-es'
@mblarsen
mblarsen / App.vue
Last active November 13, 2017 06:47
Vue Editor Tutorial - Step 1 - App.vue
<template>
<div class="split">
<div class="split__item">
<cms-page v-model="content"></cms-page>
<source-text v-model="content"></source-text>
</div>
<div class="split__item">
<front-page v-model="content"></front-page>
</div>
</div>
@mblarsen
mblarsen / package.json
Last active November 9, 2017 03:11
gitschwifty package.json scripts
"scripts": {
"begin": "git reset --hard start",
"complete": "git reset --hard complete",
"previous": "git reset --hard complete",
"next": "git reset --hard $(git describe --tags)",
"reset": "git reset --hard $(git describe --tags)",
"current": "echo \"You are at step \"$(git describe --tags)"
}
import Vue from 'vue'
import Acl from 'vue-browser-acl'
Vue.use(Acl, user, (acl) => {
acl.rule(view, Post)
acl.rule([edit, delete], Post, (user, post) => post.userId === user.id)
acl.rule('moderate', Post, (user) => user.isModerator())
})