Skip to content

Instantly share code, notes, and snippets.

View AlbinoDrought's full-sized avatar
🇨🇦
Use AGPL

Sean AlbinoDrought

🇨🇦
Use AGPL
View GitHub Profile
paste <(fortune | cowsay -f ren) <(fortune | cowsay -f stimpy) | pr -t -e100
@AlbinoDrought
AlbinoDrought / wrapLoading.js
Created August 1, 2017 17:15
Vue.js promise-loading mixin
export default {
data() {
return {
loading: false,
loadingText: null,
};
},
methods: {
load(promise, text) {
@AlbinoDrought
AlbinoDrought / mountWatch.js
Created August 1, 2017 17:38
Vue.js mixin to reduce `mount` and `watch` boilerplate
function mountWatch(propName, methodName) {
const mixin = {
mounted() {
this[methodName]();
},
watch: {
[propName]() {
this[methodName]();
},
// ==UserScript==
// @name New Bitbucket Eyebleach
// @namespace http://minge.party/
// @version 0.1
// @description Changes the color of the bitbucket sidebar to the old one.
// @author AlbinoDrought
// @match *://bitbucket.org/*
// @grant none
// ==/UserScript==
@AlbinoDrought
AlbinoDrought / vue-bubble.js
Last active August 7, 2018 17:42
Vue event-bubbling directive
/**
v-bubble directive
Usage:
- v-bubble:eventName
- v-bubble:eventName="newEventName"
Examples:
- v-bubble:input is equivalent to @input="val => { $emit('input', val) }"
- v-bubble:input="select" is equivalent to @input="val => { $emit('select', val) }"
@AlbinoDrought
AlbinoDrought / NullableJsonResponse.php
Created August 15, 2017 18:08
Nullable Laravel JSON response
<?php
namespace App\Http\Responses;
use Illuminate\Http\JsonResponse;
class NullableJsonResponse extends JsonResponse
{
public function __construct($data = null, $status = 200, array $headers = [], $options = 0)
{
#!/bin/sh
# create-index.sh
# Creates an ES6-compatible index.js file for all files in a folder.
#
# Usage:
# ./create-index.sh src/
# Recursive Usage:
# ls -R src/ | grep : | sed 's/://' | xargs -I@ ./create-index.sh @
#
@AlbinoDrought
AlbinoDrought / autoEventBinderUnbinder.js
Created September 26, 2017 21:32
Vue mixin for automatic unbinding of element and EventEmitter events
/*
Ever have this issue?
(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Swap your bindings in mounted() to:
this.bindEvent(serviceInstance, 'foo', () => {
console.log('hello world');
}, true);
@AlbinoDrought
AlbinoDrought / usableBitbucketIssueTracker.greasemonkey.js
Created January 16, 2018 21:42
Force names on the Bitbucket issue tracker to be readable, even on skinny windows.
// ==UserScript==
// @name Anti-Squishy
// @version 0.0
// @match https://bitbucket.org/*/issues
// @grant none
// ==/UserScript==
window.document.styleSheets[0].insertRule('@media (max-width:1200px){table.issues-list thead tr th:nth-child(1){min-width:500px}}', window.document.styleSheets[0].length);
@AlbinoDrought
AlbinoDrought / .tigrc
Last active October 9, 2018 16:13
My basic af .tigrc
# Press ctrl+a to amend the last commit with whatever is staged
bind status <Ctrl-A> !git commit --amend
# Press shift+p to push
# requires `git config --global push.default current`
bind status P !git push -u