Instantly share code, notes, and snippets.

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:
<Router>
<Scene key='root'>
<Drawer
hideNavBar
View AndroidEmulatorAlias.sh
//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
View RNassembleRelease.sh
you'll need a keystore.properties 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 keystore.properties and .keystore file and your build works on a device in debug,
it should build for release
View mouseover.js
window.onmouseover=function(e) {
console.log(e.target.className);
};
View xcodecleanup.sh
#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
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();
service.getDistanceMatrix(
{
origins: [origin1, origin2],
destinations: [destinationA, destinationB],
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;
View .gitconf
https://stackoverflow.com/questions/12265729/what-are-the-consequences-of-using-receive-denycurrentbranch-in-git
steps:
on remote -
git init
git config receive.denyCurrentBranch updateInstead
This will overwrite anything currently in the directory with a push from local
View gist:20461145fe00bbcd3bb628e4535faf60
function_to_execute(){
//this schedules the event (time+3 seconds) with arguments that are passed to the function
wp_schedule_single_event( time() + 3, 'my_action', array($permalink) );
spawn_cron();
}
//this is the task that gets added via add_action, should go in functions.php or other parent-level functions file
function my_task($permalink) {
echo $permalink;
View .htaccess
#create domain with https, set up certs, test individually
#then create a website as same domain, but without https, add htaccess with values below in webapp location
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-SSL} !on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]