Skip to content

Instantly share code, notes, and snippets.

View listenrightmeow's full-sized avatar
🦍

Mike Dyer listenrightmeow

🦍
View GitHub Profile
@listenrightmeow
listenrightmeow / .gitconfig
Created July 19, 2023 23:17
Push history-less/empty branch to origin
[alias]
empty = "!sh -c 'git switch --orphan $0 && git commit --allow-empty -m \"empty commit\" && git rebase --onto master $0 && git push -u origin $0'"
import { expect } from 'chai';
import { bool } from 'aws-sdk/clients/signer';
describe('codewars', () => {
it('set unique', () => {
const arrayDiff = (l, r) => Array.from(new Set(l.concat(r)));
const t = arrayDiff([1, 2], [2]);
expect(t).to.have.lengthOf(2);
@listenrightmeow
listenrightmeow / config.toml
Last active August 27, 2019 23:45
Gitlab Spot Runners
# https://gitlab.com/gitlab-org/gitlab-runner/issues/3021
# TODO: token cannot have an underscore
# https://aws.amazon.com/ec2/spot/pricing/
# TODO: calculate base spot pricing
concurrent = 10
check_interval = 0
[[runners]]
name = "gitlab-aws-autoscaler-<service>" # TODO: modify here
@listenrightmeow
listenrightmeow / prototype.js
Created February 8, 2019 22:12
simple array flat prototype
Object.defineProperty(Array.prototype, 'flat', {
value: function(res = []) {
Object(this).forEach(cursor => {
if (Object.prototype.toString.call(cursor) === '[object Array]') {
cursor.flat(res);
} else {
res.push(cursor);
}
});
@listenrightmeow
listenrightmeow / app.jsx
Last active July 14, 2017 18:04
lazyloaded react application POC
import React from 'react';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
import { applyMiddleware, combineReducers, createStore } from 'redux';
import thunk from 'redux-thunk';
import router from './router';
import reducer from 'reducers/default';
window.NAMESPACE.store = createStore(
[user]
name = listenrightmeow
email =
signingkey =
[alias]
all = !git branch -a | grep
br = checkout -b
ba = branch --all
changelog = !git log $1...$2 --pretty=format:'- %s' --abbrev-commit --no-merges
co = checkout
import sys
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'standard': {
'format': '%(asctime)s [%(levelname)s] %(name)s: %(message)s'
}
},
clusterName: us-west-2
externalDNSName: k8.svc.production.tld
createRecordSet: true
recordSetTTL: 300
hostedZoneId: ...
keyName: kube-aws
region: us-west-2
kmsKeyArn: ...
controllerCount: 2
controller:
@listenrightmeow
listenrightmeow / functions.php
Last active September 10, 2015 00:58
Generate responsive image after Media Library upload with Wordpress
<?php
function create_responsive_images($id) {
$file = get_attached_file($id);
$image = wp_get_image_editor($file);
if (!is_wp_error($image)) {
$dimensions = $image->get_size();
$width = $dimensions['width'];
$sizes = array();
$measurements = array(0.14, 0.26, 0.28, 0.35, 0.3875, 0.50, 0.52, 0.70, 0.775);
@listenrightmeow
listenrightmeow / ics.js
Created August 17, 2015 22:32
Dynamic ICS
$(target, this.$el).on('click', function() {
var now = new Date(),
dtstamp = now.toISOString(),
dtend = function() { now.setHours(19,0,0,0); return now; },
dtstart = function() { now.setHours(18,0,0,0); return now; },
meow = 'location',
summary = 'summary',
icsMSG = 'BEGIN:VCALENDAR\nVERSION:2.0\n' +
'PRODID:-//Take Back The Table//NONSGML v1.0//EN\n' +
'CALSCALE:GREGORIAN\n' +