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 / deploy.yaml
Last active July 24, 2022 13:27
Solution for `git clone` using Ansible for repos with private submodules with github deploy keys
# 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 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
/**
* 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 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": "{ }"
}'
@mblarsen
mblarsen / app__Console__Commands__WebpackCommand.php
Last active June 11, 2018 00:43
Laravel and Webpack (with webpack-dev-server)
<?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 15:17
WordPress style shortcodes in 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'

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', {