Skip to content

Instantly share code, notes, and snippets.

View brendanlim's full-sized avatar

Brendan G. Lim brendanlim

View GitHub Profile
@BondAnthony
BondAnthony / wall-connector-influxdb.yaml
Last active October 7, 2023 07:45
Tesla Wall Connector
apiVersion: influxdata.com/v2alpha1
kind: Variable
metadata:
name: wizardly-northcutt-83c00b
spec:
associations:
- kind: Label
name: frosty-hamilton-83c001
name: kwh_price
description: Price per kilowatt-hour
@soffes
soffes / Array+Each.swift
Created July 17, 2014 19:08
Each on Array in Swift
extension Array {
func each(block: ((Element) -> Void)) {
for i in 0..<count {
block(self[i])
}
}
func eachWithIndex(block: ((Element, Int) -> Void)) {
for i in 0..<count {
block(self[i], i)
@calebd
calebd / ArrayHelpers.swift
Last active November 4, 2022 15:17
Swift Helpers
extension Array {
func first() -> Element? {
if isEmpty {
return nil
}
return self[0]
}
func last() -> Element? {
@jmbeck
jmbeck / gist:babb1b6446fe0e0872ab
Created May 21, 2014 15:25
Kochava Slow Startup on Main Thread
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
CLS_LOG(@"launchOptions: %@", launchOptions);
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"kothredupios3903535ae2e402049", @"kochavaAppId",
// @"1", @"enableLogging",
@"1", @"retrieveAttribution",
nil];
NSLog(@"*** Begin init ***");
@namuol
namuol / INSTALL.md
Last active July 24, 2023 11:53
rage-quit support for bash

rage-quit support for bash

HOW TO INSTALL

Put flip somewhere in your $PATH and chmod a+x it.

Copy fuck into ~/.bashrc.

@aprato
aprato / AMPNavigationBar.m
Last active July 13, 2018 00:23
Darker iOS7 translucent UINavigationBar
// .h
@interface AMPNavigationBar : UINavigationBar
@property (nonatomic, assign) CGFloat extraColorLayerOpacity UI_APPEARANCE_SELECTOR;
@end
// .m
@jhclark
jhclark / latency.txt
Created May 31, 2012 19:58 — forked from jboner/latency.txt
Latency numbers every programmer should know
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 1 MB sequentially from memory 250,000 ns 0.25 ms
Round trip within same datacenter 500,000 ns 0.5 ms
Read 1 MB sequentially from SSD 1,000,000 ns 1 ms 4X memory