Instantly share code, notes, and snippets.

Ben Fausch BenFausch

View GitHub Profile
BenFausch / RNRFDrawer.js
Created Dec 20, 2017
Side navigation for React Native Router Flux v4, using drawer, opens and closes with button
View RNRFDrawer.js
//been trying to find an example with RNRF that has a drawer that can be opened and closed with a
//button, and responds in the same way as v3
//it's been impossible to find this anywhere in the docs, so here's a few snippets to help out
//so here you have your new basic nav router setup:
<Scene key='root'>
BenFausch /
Created Dec 22, 2017
Run Android emu from command line
//this lists available devices:
alias listAndroid='cd ~/Library/Android/Sdk/tools/bin && ./avdmanager list avd'
response looks like this:
Available Android Virtual Devices:
Name: Nexus_5X_API_24
Device: Nexus 5X (Google)
Path: /Users/benfausch/.android/avd/Nexus_5X_API_24.avd
Target: Google Play (Google Inc.)
Based on: Android 7.0 (Nougat) Tag/ABI: google_apis_playstore/x86
BenFausch /
Created Jan 5, 2018
Assemble release for RN android
you'll need a file that is in the root of PROJECT/android
then put a .keystore file in android/app/ i.e. PROJECTNAME.keystore
in terminal, use the following command when in your main project folder:
cd android && ./gradlew assembleRelease
if you have the correct and .keystore file and your build works on a device in debug,
it should build for release
BenFausch / mouseover.js
Created Jan 7, 2018
log all mouseover events, useful for finding elements to target
View mouseover.js
window.onmouseover=function(e) {
BenFausch /
Created Jan 9, 2018
Xcode Project cleanup
#removes derived data:
rm -rf ~/Library/Developer/Xcode/DerivedData
#removes modulecache:
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
#cmd+shift+opt+k = full build folder clean
BenFausch / bannerperf.php
Last active Oct 25, 2018
Pull banner performance from sailthru to CSV file, by month
View bannerperf.php
// create this file somewhere
include "simple_html_dom.php";
require_once __DIR__ . '/inc/sailthru.php';
//Load sailthru client
global $sailthruSettings;
$sailthru = new Sailthru_Client($sailthruSettings['key'], $sailthruSettings['secret']);
BenFausch / .bash_profile
Last active Jul 31, 2018
Profile, git config, and bash-completion
View .bash_profile
#run this to open things with sublime:
#ln -s "/Applications/Sublime" /usr/local/bin/sublime
#open profile
alias profile="sublime ~/.bash_profile"
alias reloadprofile="source ~/.bash_profile"
#manage wifi
alias wifion="networksetup -setairportpower airport on"
alias wifioff="networksetup -setairportpower airport off"
BenFausch / proximity.js
Created Mar 5, 2018
Basic proximity/driving directions using the google maps api, returns JSON
View proximity.js
var origin1 = new google.maps.LatLng(55.930385, -3.118425);
var origin2 = 'Greenwich, England';
var destinationA = 'Stockholm, Sweden';
var destinationB = new google.maps.LatLng(50.087692, 14.421150);
var service = new google.maps.DistanceMatrixService();
origins: [origin1, origin2],
destinations: [destinationA, destinationB],
BenFausch / checker.js
Created Mar 9, 2018
user an array of key names to verify that they're in an object, add empty array with key 0 if false
View checker.js
var checker = ['attain-location-address-1', 'attain-location-address-2', 'attain-location-city', 'attain-location-state', 'attain-location-zipcode']
for (var i = 0; i < checker.length; i++) {
if (!result['custom_fields'].hasOwnProperty(checker[i])) {
result['custom_fields'][checker[i]] = [];
result['custom_fields'][checker[i]][0] = '';
return result;
BenFausch / .gitconf
Created Mar 12, 2018
Git config for servers
View .gitconf
on remote -
git init
git config receive.denyCurrentBranch updateInstead
This will overwrite anything currently in the directory with a push from local