Skip to content

Instantly share code, notes, and snippets.

View listenrightmeow's full-sized avatar
🦍

Mike Dyer listenrightmeow

🦍
View GitHub Profile
@listenrightmeow
listenrightmeow / mofile.rb
Last active August 29, 2015 14:01
Remove dups with MD5 hashing
require 'digest/md5'
h = {}
Dir.glob("**/*", File::FNM_DOTMATCH).each do |f|
next if File.directory?(f)
k = Digest::MD5.hexdigest(IO.read(f)).to_sym
if h.has_key? k
h[k].push f
@listenrightmeow
listenrightmeow / lodr.js
Last active August 29, 2015 14:25
Fidel Examples
window.Lodr = fidel.define('lodr', {
defaults : {
backgroundString : 'url(\'__\')',
callback : [],
height : window.innerHeight || document.documentElement.clientHeight,
srcsetTimeout : 60,
retina : !!window.hasOwnProperty('devicePixelRatio') && window.devicePixelRatio >= 2,
responsive : {
small : 480,
medium : 768,
@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' +
@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);
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:
import sys
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'standard': {
'format': '%(asctime)s [%(levelname)s] %(name)s: %(message)s'
}
},
[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
@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(
@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 / 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