Skip to content

Instantly share code, notes, and snippets.

@bdragon
bdragon / pod-logs.bash
Created April 29, 2021 19:50
Tail kubectl logs from multiple selected pods with colorized output.
#!/bin/bash
set -euo pipefail
# Tail kubectl logs from multiple selected pods with colorized output.
function usage() {
local name="$(basename "${BASH_SOURCE[0]}")"
echo "Synopsis:"
echo -e "\t$name -n NAMESPACE -l SELECTOR [ -- KUBECTL_LOGS_ARGS ]\n"
package main
import (
"fmt"
"reflect"
)
// concat returns a slice of type t that contains the specified items.
// Each item is appended according to its type: if it has type t, it is
// appended; if it is a slice of values of type t, each of its elements
# == Library code ===========================================
class Result
def self.success(value)
new(nil, value)
end
def self.error(err)
new(err, nil)
end
[{"loan":{"id":1,"borrower_id":1,"amount":10984659,"term":120},"period":{"start_at":"2017-05-22T00:00:00-06:00","end_at":"2017-06-21T23:59:59-06:00"},"principal":57702,"interest":83752,"rate_annual":900,"service_fee":{"amount":0,"rate":0}},{"loan":{"id":1,"borrower_id":1,"amount":10984659,"term":120},"period":{"start_at":"2017-06-22T00:00:00-06:00","end_at":"2017-07-21T23:59:59-06:00"},"principal":56262,"interest":80629,"rate_annual":900,"service_fee":{"amount":0,"rate":0}},{"loan":{"id":1,"borrower_id":1,"amount":10984659,"term":120},"period":{"start_at":"2017-07-22T00:00:00-06:00","end_at":"2017-08-21T23:59:59-06:00"},"principal":58577,"interest":82877,"rate_annual":900,"service_fee":{"amount":0,"rate":0}},{"loan":{"id":1,"borrower_id":1,"amount":10984659,"term":120},"period":{"start_at":"2017-08-22T00:00:00-06:00","end_at":"2017-09-21T23:59:59-06:00"},"principal":59026,"interest":82428,"rate_annual":900,"service_fee":{"amount":0,"rate":0}},{"loan":{"id":1,"borrower_id":1,"amount":10984659,"term":120},"peri
@bdragon
bdragon / object.extend.js
Created August 7, 2013 22:08
Inheritance model with support for inheriting static properties, prototype properties, and ECMAScript 5 getters/setters, as well as for calling "super". See http://www.bryandragon.com/articles/playing-with-javascript-inheritance
/**
* Object.extend()
* @author Bryan Dragon
* @website www.bryandragon.com
* @license MIT License
*/
(function () {
'use strict';
var hasOwn = Object.prototype.hasOwnProperty
/**
* mobile-viewport.js
*
* Simple script to hide the address bar on iPhone and iPod (when not in fullscreen app mode).
*/
(function () {
var ADDR_BAR_HEIGHT = 60,
app = document.getElementById('myDomEl'),
ua = navigator.userAgent,
iphone = ~ua.indexOf('iPhone') || ~ua.indexOf('iPod'),