Skip to content

Instantly share code, notes, and snippets.

View cawfree's full-sized avatar
😍

cawfree cawfree

😍
View GitHub Profile
@cawfree
cawfree / from-powerwash-to-react-native.md
Last active July 8, 2019 08:16
From Powerwash to React Native

From Powerwash to React Native

I seem to end up powerwashing my Chromebook all of the time, to the extent that the process of regaining my full development environment in under an hour has become as minimal as I intend to make it.

Since I feel that I've gone as far as I can, I figured documenting the steps involved might be of some value to you. I've tried this on a number of different Chromebooks, so you shouldn't hit any major stumbling blocks*. However, if you do, feel free to tweet me @cawfree.

*arm-v7

So, here's the no deep sh*t guide on how to make your Chromebook React Native ready.

From scratch.

@cawfree
cawfree / case.js
Last active April 19, 2024 13:58
Convert between Camel Case (camelCase) and Snake Case (snake_case) in ES6
export const toCamelCase = (e) => {
return e.replace(/_([a-z])/g, (g) => g[1].toUpperCase());
};
export const toSnakeCase = (e) => {
return e.match(/([A-Z])/g).reduce(
(str, c) => str.replace(new RegExp(c), '_' + c.toLowerCase()),
e
)
.substring((e.slice(0, 1).match(/([A-Z])/g)) ? 1 : 0);
@cawfree
cawfree / jovo_google_action_permission.js
Last active November 18, 2017 19:30
An example permissions request for Jovo.
import { SpeechBuilder } from 'jovo-framework/lib/platforms/speechBuilder';
import { jovo } from 'jovo-framework/lib/jovo';
/**
* agent: /intGetNamePermission
* inputContext: <none>
* userStateIn: <none>
* action: ask for the user's name.
* userStateOut: <none>
* outputContext: <none>
*/
/**
* Created by Alexander Thomas (@Cawfree) on 06/03/2017.
* This class is used to benchmark base functionality with the connected device we'll be using for testing.
*/
// Run using JUnit4.
@RunWith(AndroidJUnit4.class)
public class InitializeTest {
/** Test whether we have access to the base application context. */
@cawfree
cawfree / HeterogeneousAdapter.java
Last active March 19, 2018 10:21
Heterogeneous Recycler Adapter; a simple way to define diverse RecyclerView content.
/**
* Created by Alexander Thomas (@Cawfree) on 03/07/2017.
*/
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
@cawfree
cawfree / gist:61a96b4ab5d863224beffb424f3f294b
Created April 11, 2017 00:20
Basic JavaScript I/O for FlowHub
// TheGraph.App
<polymer-element name="the-graph-editor"
javascript:alert(JSON.stringify(document.querySelector('the-graph-editor')));
Polymer('the-graph-editor', {
javascript:alert(JSON.stringify(document.querySelector('the-graph-editor').grid));
javascript:alert(JSON.stringify(document.querySelector('the-graph-editor').grid));
javascript:alert(JSON.stringify(document.querySelector('the-graph-editor').menus));
@cawfree
cawfree / gist:9da3c378dd86975f187df92626fe684f
Created March 20, 2017 23:52
Security Exception; DL4J on the Google App Engine
Mar 20, 2017 11:51:21 PM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: Nested in java.lang.ExceptionInInitializerError:
java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "createSecurityManager")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
at java.security.AccessController.checkPermission(AccessController.java:884)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:442)
at java.lang.SecurityManager.<init>(SecurityManager.java:299)
at org.slf4j.helpers.Util$ClassContextSecurityManager.<init>(Util.java:43)
at org.slf4j.helpers.Util$ClassContextSecurityManager.<init>(Util.java:43)
@cawfree
cawfree / model.java
Created March 18, 2017 00:19
model null?
model = {MultiLayerNetwork@6104}
defaultConfiguration = {NeuralNetConfiguration@6111} "NeuralNetConfiguration(layer=DenseLayer(super=FeedForwardLayer(super=Layer(layerName=layer0, activationFn=tanh, weightInit=XAVIER, biasInit=0.0, dist=null, learningRate=0.1, biasLearningRate=0.1, learningRateSchedule=null, momentum=0.9, momentumSchedule={}, l1=0.0, l2=0.0, l1Bias=0.0, l2Bias=0.0, dropOut=0.0, updater=NESTEROVS, rho=NaN, epsilon=NaN, rmsDecay=NaN, adamMeanDecay=NaN, adamVarDecay=NaN, gradientNormalization=None, gradientNormalizationThreshold=1.0), nIn=4, nOut=3)), leakyreluAlpha=0.0, miniBatch=true, numIterations=1, maxNumLineSearchIterations=5, seed=1489796271540, optimizationAlgo=STOCHASTIC_GRADIENT_DESCENT, variables=[0_W, 0_b, 1_W, 1_b], stepFunction=null, useRegularization=false, useDropConnect=false, minimize=true, learningRateByParam={}, l1ByParam={}, l2ByParam={}, learningRatePolicy=None, lrPolicyDecayRate=NaN, lrPolicySteps=NaN, lrPolicyPower=NaN, pretrain=false, iterationCount=0)"
epsilon = null
@cawfree
cawfree / zipfile.java
Created March 18, 2017 00:14
zipfile prior to null (void method flush)
zipfile = {ZipOutputStream@6182}
archiveNeedsZip64EocdRecord = false
cDir = null
commentBytes = {byte[0]@6195}
compressionLevel = -1
crc = {CRC32@6196}
currentEntry = null
currentEntryNeedsZip64 = false
defaultCompressionMethod = 8
entries = {HashSet@6197} size = 2
@cawfree
cawfree / gist.java
Created March 17, 2017 23:53
Some DL4j/ND4J specific console errors
03-17 23:47:45.321 9244-9381/io.github.cawfree.preflop W/System.err: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
03-17 23:47:45.321 9244-9381/io.github.cawfree.preflop W/System.err: SLF4J: Defaulting to no-operation (NOP) logger implementation
03-17 23:47:45.321 9244-9381/io.github.cawfree.preflop W/System.err: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
03-17 23:47:46.181 9244-9381/io.github.cawfree.preflop W/linker: /data/app/io.github.cawfree.preflop-1/lib/arm/libnd4jcpu.so: unused DT entry: type 0xf arg 0xa683
03-17 23:47:46.201 9244-9381/io.github.cawfree.preflop W/linker: /data/app/io.github.cawfree.preflop-1/lib/arm/libjnind4jcpu.so: unused DT entry: type 0xf arg 0x15125
03-17 23:47:46.551 9244-9381/io.github.cawfree.preflop W/linker: /data/app/io.github.cawfree.preflop-1/lib/arm/libjniopenblas.so: unused DT entry: type 0xf arg 0xea58