Skip to content

Instantly share code, notes, and snippets.

Avatar
✌️
Casual coding

Ullrich Schäfer stigi

✌️
Casual coding
View GitHub Profile
@stigi
stigi / @react-native-community+cli-platform-android+5.0.1-alpha.1.patch
Created Apr 26, 2021
Patch file causing problems with `patch-package` on windows
View @react-native-community+cli-platform-android+5.0.1-alpha.1.patch
diff --git a/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.d.ts b/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.d.ts
index 54ed145..02dbbf4 100644
--- a/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.d.ts
+++ b/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.d.ts
@@ -2,7 +2,8 @@ import { Config } from '@react-native-community/cli-types';
export interface Flags {
tasks?: Array<string>;
root: string;
- variant: string;
+ flavor: string;
@stigi
stigi / pomodoro.sh
Created Mar 25, 2020
Update your Slack status from the command line for Pomodoro
View pomodoro.sh
#!/usr/bin/env bash
text=":tomato: focus time"
emoji=":tomato:"
expiration=`date +%s`
expiration=$((expiration + 1500))
data=$( jq -n \
View AsyncButton.tsx
import React from 'react'
import { Button } from 'react-native'
interface Props {}
interface State {
isDoing: boolean
}
export class WithButton extends React.Component<Props, State> {
public state: State = { isDoing: false }
View @nozbe+watermelondb+0.12.3.patch
diff --git a/node_modules/@nozbe/watermelondb/WatermelonDB.podspec b/node_modules/@nozbe/watermelondb/WatermelonDB.podspec
new file mode 100644
index 0000000..bb0eac2
--- /dev/null
+++ b/node_modules/@nozbe/watermelondb/WatermelonDB.podspec
@@ -0,0 +1,19 @@
+require "json"
+
+Pod::Spec.new do |s|
+ # NPM package specification
View gist:518a0c97ca38933ff58dacc672b522de
~ code --list-extensions --show-versions
bungcip.better-toml@0.3.2
christian-kohler.npm-intellisense@1.3.0
donjayamanne.githistory@0.4.6
eamodio.gitlens@9.5.1
EditorConfig.EditorConfig@0.13.0
eg2.tslint@1.0.43
esbenp.prettier-vscode@1.8.1
fatihacet.gitlab-workflow@2.0.1
flowtype.flow-for-vscode@1.1.0
@stigi
stigi / persisted-hooks.js
Created Oct 27, 2018
A small experiment on how a persisted state hook good be implemented
View persisted-hooks.js
import React, { useState } from "react";
import ReactDOM from "react-dom";
const usePersistedState = (initialState, key) => {
// Check if we have a value stored
let value = localStorage.getItem(key);
if (!value) {
value = initialState;
} else {
value = JSON.parse(value);
@stigi
stigi / fix-rn-xcode10-build.sh
Created Oct 24, 2018
Fixes Xcode 10 builds for older react native issues.
View fix-rn-xcode10-build.sh
#!/bin/sh
# Make sure node packages are there
yarn
# 1st fix: glog config.h not found
# Manually trigger 3rd party installs
cd node_modules/react-native
./scripts/ios-install-third-party.sh
View gist:4ddb6cfcca7173783f7329d6f389a8ec
### Keybase proof
I hereby claim:
* I am stigi on github.
* I am ullrich (https://keybase.io/ullrich) on keybase.
* I have a public key ASBvBQm1Dl9T7YVshwg3uQq5P9VyAzlN4bQNQef1Z7rzYgo
To claim this, I am signing this object:
View build.gradle
def fetchPassword(identifier) {
if (!Os.isFamily(Os.FAMILY_MAC)) {
println "Not on macOS, falling back to using keystore password from Environment"
return props.getProperty(identifier)
}
def keychainLabel = "${identifier}"
println "Fetching keychain password with label '${keychainLabel}"
def stdout = new ByteArrayOutputStream()
@stigi
stigi / doubleToInt.swift
Created Mar 12, 2018
Safely convert Double to Int and take care of overflows. Wont take care of precision for large values. Raw
View doubleToInt.swift
func doubleToInt(_ input: Double) -> Int? {
guard (
input < Double(Int.max).nextDown &&
input > Double(Int.min).nextDown)
else {
// Int overflow
return nil
}