Skip to content

Instantly share code, notes, and snippets.

View KarlPurk's full-sized avatar

Karl Purkhardt KarlPurk

View GitHub Profile
@KarlPurk
KarlPurk / gist:7105b40e63e3e721a313
Created March 3, 2016 08:46
Find and replace in project with `ag` and `sed`
ag $needle -l --print0 | xargs -0 -n 1 sed -i "" "s/$needle/$replacement/g"
Nothing to see here...
Array.apply(null, Array(5))
@KarlPurk
KarlPurk / README.md
Last active March 29, 2021 14:05
Appium with Vagrant
  1. Place android.rules, Vagrantfile and bootstrap.sh in a new directory.
  2. cd to the directory you created
  3. Call vagrant up
  4. Follow instructions after bootstrap script finishes.
@KarlPurk
KarlPurk / main.cpp
Created March 29, 2014 13:07
Memory Investigation - Looking at how chars are stored in memory.
#include "stdafx.h"
#include <iostream>
using namespace std;
void printHeader()
{
cout << "Letter\t" << "ASCII\t" << "Hex\t\t" << "Address\t\n";
cout << "---------------------------------------\n";
}
@KarlPurk
KarlPurk / ArrayCombineSum.cls
Created August 6, 2013 20:59
Combine elements of an array, optionally summing specified properties. Written in ObjectScript.
Class App.ArrayCombineSum Extends %RegisteredObject
{
ClassMethod createKey(array, keys) As %String
{
set output = ""
set index = keys.Next("")
while (index) {
set key = keys.GetAt(index)
set value = array.GetAt(key)
@KarlPurk
KarlPurk / array-combine-sum.js
Last active December 20, 2015 16:09
Reduce an array based on the provided keys, optionally summing specified properties.
/**
* Combine elements of an array based on the provided keys, optionally summing specified properties
* @param data
* @param keys
* @param sum
* @returns array
*/
var arrayCombineSum = function(data,keys,sum) {
/**