Skip to content

Instantly share code, notes, and snippets.

View twobitlabs's full-sized avatar

Two Bit Labs twobitlabs

View GitHub Profile
@twobitlabs
twobitlabs / gist:561a86f06be21370a9d4
Last active August 29, 2015 14:22
search diff commits
git-search-diffs() {
if [ -z "$2" ]
then
echo "Use git-search-diffs to search for commits where the diff includes the search term"
echo "Usage: git-search-diffs <path> <search term>"
return
fi
git log -p $1 | egrep -i "^commit|^[-+].*$2" | egrep -B1 ^[+-]
}
@twobitlabs
twobitlabs / gist:1504661
Created December 21, 2011 05:03
git apply-stash
apply-stash = "!bash -c 'git stash list | grep $0 && git stash apply `git stash list | grep $0 | cut -d : -f 1`'"
@twobitlabs
twobitlabs / gist:5121054
Created March 8, 2013 23:38
Sample UIKit layout code
-(void)contentUpdated {
CGFloat outsidePadding = 10;
CGFloat paddingBetweenElements = 5;
CGFloat maxHeadlineHeight = 200;
self.thumbnail.frame = (CGRect){(CGPoint){outsidePadding, outsidePadding}, self.thumbnail.image.size};
CGFloat headlineWidth = WIDTH(self) - (RIGHT(self.thumbnail) + paddingBetweenElements + outsidePadding);
CGFloat headlineHeight = [self.headline.text sizeWithFont:self.headline.font
constrainedToSize:CGSizeMake(headlineWidth, maxHeadlineHeight)].height;
@twobitlabs
twobitlabs / gist:6817817
Last active December 24, 2015 15:09
Redirect stderr from iOS simulator to a file. Add this to your main.m. Then you can filter the output with tail -f /tmp/myapp.log | grep "foo"
#warning Don't commit me
NSString *logPath = @"/tmp/myapp.log";
freopen([logPath fileSystemRepresentation], "a", stderr);
//
// HudlHlsAvPlayerCache.m
// Hudl
//
// Created by Brian Clymer on 3/6/15.
// Copyright (c) 2015 Agile Sports Technologies, Inc. All rights reserved.
//
#import "HudlHlsAvPlayerCache.h"
diff --git a/tags.json b/tags.json
index cfe769d..d8a9b43 100644
--- a/tags.json
+++ b/tags.json
@@ -1,5 +1,5 @@
{
- "last_published": "2017-04-19 20:42:30 +0000",
+ "last_published": "2017-04-20 00:22:44 +0000",
"root": {
"children": [
{
"id": 21640,
"leagueScoresWidget": {
"games": []
},
"live_update": true,
"metadata_type": "permanent",
"name": "nfl_ts",
"native_next_game_widget": null,
"published_at": "2016-04-22T05:22:15Z",
{
"items": [
{
"color1": "911919",
"color2": "202020",
"commentary": {
"description": "",
"title": ""
},
"featured": false,
@twobitlabs
twobitlabs / gistjson
Created May 4, 2018 23:08
Command line script to capture json, pretty print it, and publish as a gist
#!/usr/bin/env bash
# Make sure you have the gist commandline tool installed.
# gem install gist
# or brew install gist
#
# Example usage: gistjson weather "https://api.weather.gov/points/37.7628,-122.4398"
# Creates https://gist.github.com/twobitlabs/b9aec0c1508d21b09dd98139a5ef3ff9
if [ -z "$1" ]
{
"@context": [
"https://raw.githubusercontent.com/geojson/geojson-ld/master/contexts/geojson-base.jsonld",
{
"@vocab": "https://api.weather.gov/ontology#",
"bearing": {
"@type": "s:QuantitativeValue"
},
"city": "s:addressLocality",
"county": {