Skip to content

Instantly share code, notes, and snippets.

View juddey's full-sized avatar

Justin Lane juddey

View GitHub Profile
updateActive ({changed, viewableItems}) {
let active = this.state.activeIndex
let firstViewableItem = viewableItems[0].index
let lastViewableItem = viewableItems[viewableItems.length - 1].index
let nextState = {renderBottom: false, renderTop: false}
if (active < firstViewableItem) {
// Item is not viewable and should be rendered sticky on **top**
nextState.renderTop = true
@juddey
juddey / docker.sh
Last active December 8, 2017 00:29
Docker
docker build -t friendlyname . # Create image using this directory's Dockerfile
docker run -p 4000:80 friendlyname # Run "friendlyname" mapping port 4000 to container port 80
docker run -d -p 4000:80 friendlyname # Same thing, but in detached mode
docker container ls # List all running containers
docker container ls -a # List all containers, even those not running
docker container stop <hash> # Gracefully stop the specified container
docker container kill <hash> # Force shutdown of the specified container
# Remove specified container from this machine
docker container rm $(docker container ls -a -q) # Remove all containers
# List all images on this machine
@juddey
juddey / reactotron.js
Created January 29, 2018 22:06
Reactotron Shiz
if (__DEV__ && console.tron) {
// straight-up string logging
console.tron.log('Hello, I\'m an example of how to log via Reactotron.')
// logging an object for better clarity
console.tron.log({
message: 'pass objects for better logging',
someGeneratorFunction: selectAvatar
})
@juddey
juddey / android-app-build.gradle.diff
Last active February 1, 2018 00:30
Detox 7.0.1 for Android Setup - diff
android {
compileSdkVersion 25
- buildToolsVersion "25.0.1"
+ buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.tiaki"
- minSdkVersion 16
+ minSdkVersion 18
targetSdkVersion 22
@juddey
juddey / Gavyn-Quotes.txt
Created February 10, 2018 21:59
Gavyn Quotes
"Don't mow your lawns too short"
#import "AppDelegate.h"
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import "RCCManager.h"
#import <React/RCTLinkingManager.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
@juddey
juddey / transcoder.ex
Created April 17, 2018 19:34
Transcoding first attempt
defmodule Texapp.ServiceMonitor do
@services [Texapp.ServiceMonitor.Transcoder]
defmodule Result do
defstruct score: 0, text: nil, url: nil
end
def start_link(service, query, query_ref, owner) do
service.start_link(query, query_ref, owner)
end
@juddey
juddey / something.jsx
Last active June 23, 2018 02:35
RNN-plain
import React from "react";
import { Text } from "react-native";
import { Navigation } from 'react-native-navigation';
class Simple extends React.Component {
render() {
return (<Text>Hello, I'm Awesome.</Text>);
}
}
@juddey
juddey / gist:34d64c46a0e0004ee01a5be53aa8f452
Created August 5, 2018 20:01
Hardware Spec for zerk's PC
a mandatory warning: not a professional hardware person here
https://www.pbtech.co.nz/product/CPUIT4560/Intel-Kaby-Lake-Pentium-G4560-35Ghz-Socket-LGA1151
https://www.pbtech.co.nz/product/MBDASU42105/ASUS-PRIME-H270-PRO-ATX-For-Intel-Kaby-Lake-LGA115
https://www.pbtech.co.nz/product/MEMCRU069200/Crucial-16GB-DESKTOP-DDR4-2400-MTs-PC4-19200-CL17
https://www.pbtech.co.nz/product/HDDSAM3500/Samsung-850-EVO-MZ-75E500BW-500GB-3D-V-NAND-SATA-I
https://www.pbtech.co.nz/product/MONDEL3018787/Dell-P2416D-24-WQHD-IPS-LED-Business-Monitor-2560X
https://www.pbtech.co.nz/product/CHAFSP71070/FSP-P1802-Mid-Tower-Case---2xUsb30---Dust-Filters
@juddey
juddey / CentreSelector.test.js
Created October 12, 2018 04:27
Centre-Selector-Unit-Test
import React from 'react'
import { render } from 'testUtils'
import { fireEvent } from 'react-testing-library'
import CentreSelector from './CentreSelector'
const centres = [
{
centre_id: '123',
centre_name: 'Demo Centre'
},