Skip to content

Instantly share code, notes, and snippets.

View drhuffman12's full-sized avatar

Daniel Huffman drhuffman12

View GitHub Profile
import { transform, isEqual, isObject } from "lodash";
import Reactotron from "reactotron-react-native";
export const stateChanges = (object: any, base: any): Object => {
return transform(object, (result, value, key) => {
if (!isEqual(value, base[key])) {
// @ts-ignore
result[key] =
isObject(value) && isObject(base[key])
? stateChanges(value, base[key])
@amhinson
amhinson / Screen.js
Created June 24, 2019 16:04
React Native - Enable scrolling only when content is larger than screen
const DEVICE_HEIGHT = Dimensions.get("window").height;
const Screen = () => {
const [screenHeight, setScreenHeight] = useState(0);
function onContentSizeChange(contentWidth, contentHeight) {
setScreenHeight(contentHeight);
}
const scrollEnabled = screenHeight > DEVICE_HEIGHT;
@notozeki
notozeki / Makefile
Last active March 22, 2023 16:27
An example Ruby extension written in Crystal
CRYSTAL = crystal
UNAME = "$(shell uname -ms)"
LIBRARY_PATH = $(shell brew --prefix crystal-lang)/embedded/lib
LIBS = -levent -lpcl -lpcre -lgc -lpthread
LDFLAGS = -Wl,-undefined,dynamic_lookup
TARGET = crystal_example_ext.bundle
$(TARGET): crystal_example_ext.o
$(CC) -bundle -L$(LIBRARY_PATH) -o $@ $^ $(LIBS) $(LDFLAGS)
@drhuffman12
drhuffman12 / gnuroot_wheezyx_to_jessie_jruby
Last active February 6, 2018 05:54
Upgrade gnuroot wheezyX on android ARM to jessie and add java and jruby
# Download Oracle Jdk 8 for Linux 32bit from:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-arm-downloads-2187472.html
# ... The download should be a file like: jdk-8u33-linux-arm-vfp-hflt.tar.gz
# Download JRuby from: http://www.jruby.org/download
# ... The download should be a file like: jruby-bin-1.7.18.tar.gz, jruby-bin-9.0.0.0.pre1.tar.gz
# Install 'GNURoot' and 'GNURoot Wheezy x86' from app store, see:
# [gnuroot app](https://play.google.com/store/apps/details?id=champion.gnuroot&hl=en)
# [gnuroot repo](https://github.com/corbinlc)
@atifaziz
atifaziz / WebQuery.bas
Created February 27, 2014 13:08
Add or update an Excel WebQuery
Function AddOrUpdateWebQuery(ByVal URL As String, Optional DontRefresh As Boolean = False) As QueryTable
Dim Connection As String: Connection = "URL;" & URL
Dim PostText As String: Dim Parts() As String
If Len(URL) > 1024 Then
' URL exceeds 1K so use HTTP POST to get around the limit
Parts = Split(URL, "?", 2)
URL = Parts(LBound(Parts))
If UBound(Parts) > LBound(Parts) Then PostText = Parts(UBound(Parts))