Skip to content

Instantly share code, notes, and snippets.

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 / deploy.yaml
Last active Aug 2, 2021
Solution for `git clone` using Ansible for repos with private submodules with github deploy keys
View deploy.yaml
# Problem:
#
# If you use git submodules linking two private github repos, you'll need to create a separate deploy key for each.
# Multiple keys are not supported by Ansible, nor does ansible (when running git module) resort to your `.ssh/config` file.
# This means your ansible playbook will hang in this case.
#
# You can however use the ansible git module to checkout your repo in multiple steps, like this:
#
- hosts: webserver
vars:
@mblarsen
mblarsen / toilet-demo.sh
Created Oct 24, 2020
Small script so showcase all fonts for figlet and toilet
View toilet-demo.sh
#!/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
View knockout.subscribeChanged.js
/**
* 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) {
@mblarsen
mblarsen / zsh-fix-mv.sh
Last active May 14, 2019
zsh: fix command not found: _mv
View zsh-fix-mv.sh
rm -f ~/.zcompdump*
exec zsh -l
@mblarsen
mblarsen / example.go
Last active Apr 19, 2019
A small CLI wrapper + Go test wrapper for @serverless/event-mocks
View example.go
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 Apr 17, 2019
Query buildkit builds for changes since last
View test_match.sh
#!/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": "{ }"
}'
@mblarsen
mblarsen / app__Console__Commands__WebpackCommand.php
Last active Jun 11, 2018
Laravel and Webpack (with webpack-dev-server)
View app__Console__Commands__WebpackCommand.php
<?php
namespace Supawdog\Console\Commands;
use Illuminate\Console\Command;
use Symfony\Component\Process\ProcessUtils;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Process\PhpExecutableFinder;
class WebpackCommand extends Command
@mblarsen
mblarsen / CodeSlot.vue
Last active May 19, 2018
WordPress style shortcodes in Vue
View CodeSlot.vue
/* Based on ideas described here: https://medium.com/@mblarsen/wordpress-style-shortcodes-using-vue-js-d2acd20f403f */
<script>
import 'babel-polyfill'
import { default as Tokenizer } from 'shortcode-tokenizer'
import Vue from 'vue'
import Row from 'components/ui/Row'
import Column from 'components/ui/Column'
import ProductList from 'components/content/ProductList'
import ProductCard from 'components/content/ProductCard'
View keybase.md

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 Mar 1, 2018
Array.prototype extensions
View array.js
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', {