Skip to content

Instantly share code, notes, and snippets.

View idiomatic's full-sized avatar

Brian Harrison idiomatic

  • Portland, Oregon
View GitHub Profile
package main
import (
"io"
"log"
"net/http"
)
type MethodMux struct {
GET http.Handler
###
# Sample React Native App
# https://github.com/facebook/react-native
###
'use strict'
React = require 'react-native'
{AppRegistry, StyleSheet, Text, View} = React
CoffeeProject = React.createClass
@idiomatic
idiomatic / !rclone-pretty.sh
Last active August 29, 2015 14:27
rclone output polish
#!/bin/sh
# TODO: output checking
fix_rclone_output() {
perl -ne '
BEGIN {
$|++;
sub human {
my ($size) = @_;
longestIncreasingSubsequence = (sequence) ->
startIndex = []
endIndex = []
subsequences = []
for value, i in sequence
for length in [endIndex.length..0] by -1
if (sequence[endIndex[length - 1]] ? Number.MIN_VALUE) < value < (sequence[endIndex[length]] ? Number.MAX_VALUE)
endIndex[length] = i
startIndex[length] = startIndex[length - 1] ? i
@idiomatic
idiomatic / wwdc.sh
Last active April 10, 2022 03:52
Fetch WWDC videos, slides, and sample code.
#!/bin/bash
# usage: get [ RESOLUTION [ YEAR [ IDS... ] ] ]
resolution=${1:-SD}
year=${2:-2015}
shift
shift
ids=$*
RESOLUTION=$(echo $resolution | tr '[:lower:]' '[:upper:]')
@idiomatic
idiomatic / github-ebmd-spec.md
Last active August 29, 2015 14:01
github estimating

Evidence-Based Milestone Deadlines

Compute the deadline of a GitHub Milestone based on corrected issue estimates.

  • incurs a low-impact process on assignees
  • puts estimates near all relevant details
  • permits estimate revision as easily as providing the original estimate
  • fosters single-source-of-truth for issue milestones and assignments
  • adjusts the deadline when things are added, reopened, moved, or closed
slow_random = (autocb) ->
await setTimeout defer(), 100
Math.random()
slow_buggy_random = (bugginess=0.1, cb) ->
# cannot return multi values (e.g., err and value), thus no autocb
await setTimeout defer(), 100
if Math.random() < bugginess
cb "boom"
else
@idiomatic
idiomatic / components.coffee
Last active December 16, 2015 13:08
MERGED TO lawloop/mayhem AngularJS controller decorator and components
app = angular.module 'app'
app.directive 'demo', ->
restrict: 'E'
scope: true
templateUrl: 'demo.html'