Skip to content

Instantly share code, notes, and snippets.

View codelahoma's full-sized avatar

Rod Knowlton codelahoma

View GitHub Profile
@codelahoma
codelahoma / 0_reuse_code.js
Created October 28, 2013 18:54
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@codelahoma
codelahoma / tmux.cheat
Created January 4, 2014 20:05 — forked from afair/tmux.cheat
0
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^a w
New -s <session> Create ^a c
Attach att -t <session> Rename ^a , <name>
Rename rename-session -t <old> <new> Last ^a l (lower-L)
Kill kill-session -t <session> Close ^a &
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@codelahoma
codelahoma / undermore.js
Last active August 29, 2015 13:57
A little utility to extend underscore with a couple of methods I wanted, `isCollection` and `complement`, as well as `isNot*` functions to match the `is*` functions.
module.exports = (function () {
var _ = require('underscore');
var isCollection = function(item) {
return (_.isObject(item) || _.isArray(item) || _.isArguments(item));
};
var complement = function(fn) {
return function() {

Like so: var s = `abc`;

@codelahoma
codelahoma / index.js
Created January 20, 2015 21:38
requirebin sketch
// require() some stuff from npm (like you were using browserify)
// and then hit Rebuild to run it on the right
var _ = require('lodash');
var talk = function( phraseObj ) {
var obj = _.cloneDeep(phraseObj);
return function() {
console.log(obj.phrase);
};
};

Detecting "Nothing" in Workflow.is

The iOS app Workflow is the greatest thing since whatever the last great thing was, and I am diving in head first.

One of the first problems I've run into is the inability of the If action to detect the absence of a string.

Why would you want to?

Let's say you have a workflow that's processing a JSON result that has optional fields, and there's something you'd like to do, but only if a certain key is present.

@codelahoma
codelahoma / GoogleSearch.py
Last active August 29, 2015 14:14 — forked from omz/GoogleSearch.py
GoogleSearch
# Google Search for Pythonista (iOS)
# Searches Google and copies the first result to the clipboard as
# a Markdown link in the form [title](url).
#
# Inspired by Brett Terpstra's SearchLink:
# http://brettterpstra.com/searchlink-automated-markdown-linking-improved/
import clipboard
def google(terms):
@codelahoma
codelahoma / gist:71d648a3b37061e4d15d
Last active August 29, 2015 14:25
promiseForPath - function for use with Q library
// Works like underscore-contrib's getPath function.
// Takes a promise that will resolve to an object and a dot notation string specifying a path.
//
// Cannot know if path exists in resolved value - returned promise will reject with a TypeError if you
// specify a subkey of a nonexistent key, and undefined for a single
// nonexistent key.
function promiseForPath(promise, path) {
var k = path.split('.');
return k.reduce(function(memo, item){
@@ -50,7 +50,7 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import org.apache.cordova.CallbackContext;
-import org.apache.cordova.Config;
+import org.apache.cordova.Whitelist;
import org.apache.cordova.CordovaArgs;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaWebView;
@@ -143,6 +143,7 @@ public class InAppBrowser extends CordovaPlugin {