Skip to content

Instantly share code, notes, and snippets.

View BoilingOil's full-sized avatar
🏠
Working from home

Jason BoilingOil

🏠
Working from home
View GitHub Profile
watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf $TMPDIR/npm-* && rm -rf $TMPDIR/haste-* && rm -rf $TMPDIR/metro-* && rm -rf node_modules && npm install && rm -rf ios/Pods && cd ios && pod cache clean --all && pod repo update && pod install && ./android/gradlew clean -p ./android/ && rm -rf ios/build && rm -rf ~/Library/Developer/Xcode/DerivedData && npm start -- --reset-cache
@BoilingOil
BoilingOil / .eslintrc.js
Created September 18, 2020 18:47 — forked from Rob117/.eslintrc.js
Eslint for React Native, sensible settings
module.exports = {
extends: 'universe/native',
plugins: ['react', 'react-native'],
rules: {
'react/jsx-closing-bracket-location': 2,
'brace-style': [2, '1tbs'],
'react/jsx-max-props-per-line': [
'error',
{ maximum: 1, when: 'multiline' }
],
import React, { Component } from 'react'
import { Image, Animated, View } from 'react-native'
export default class LazyImage extends Component {
constructor(props) {
super(props)
this.state = {
thumbnailOpacity: new Animated.Value(0),
key: this.genKey()
@BoilingOil
BoilingOil / Install_tmux
Created January 25, 2020 18:24 — forked from simme/Install_tmux
Install and configure tmux on Mac OS X
# First install tmux
brew install tmux
# For mouse support (for switching panes and windows)
# Only needed if you are using Terminal.app (iTerm has mouse support)
Install http://www.culater.net/software/SIMBL/SIMBL.php
Then install https://bitheap.org/mouseterm/
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/

Note

Apple will reject apps that are using private url schemes (Ugh, Apple....) if they are pretty much obvius. Some apps are rejected and others are not, so, be aware of this issue before implementing any of those URL's in your app as a feature.

Updates

  • [UPDATE 4] iOS 10 update: apparently settings now can be reached using App-Pref instead of prefs
  • [UPDATE 3] For now you just can use url schemes to open your apps's settings with Swift 3.0 (Xcode 8). I'll keep you informed when OS preferences can be reached
  • [UPDATE 2] The openURL() method of UIApplication is now deprecated. You should use application(_:open:options:) instead
  • [UPDATE 1] Not yet tested in iOS 10. It will fail because of policies changes in URL scheme handling.
@BoilingOil
BoilingOil / Android auto increment build number
Created January 16, 2020 22:00 — forked from marcandreappel/Android auto increment build number
Android Studio auto increment build number for version code
# First create the file version.properties with value VERSION_BUILD=0
# In app/build.gradle:
android {
def versionPropsFile = file('version.properties')
def versionBuild
if (versionPropsFile.canRead()) {
def Properties versionProps = new Properties()
versionProps.load(new FileInputStream(versionPropsFile))
@BoilingOil
BoilingOil / package.json
Created March 11, 2019 15:23
Walaby.js + React Native 0.55: package.json
{
"name": "wallaby_setup_55",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.3.1",
@BoilingOil
BoilingOil / wallaby.js
Created March 11, 2019 15:20
Wallaby.js + React Native 0.55: Wallaby Config
module.exports = function(wallaby) {
return {
files: [
'src/**/*.js',
'package.json',
'!src/**/__tests__/*.js',
'!src/**/*.test.js',
],
tests: [
@BoilingOil
BoilingOil / wallaby.js
Created February 21, 2019 21:03 — forked from yleflour/wallaby.js
Wallaby + React Native
/*
WallabyJS React Native Config
Works well with Jest + Enzyme
*/
/* eslint-disable */
module.exports = function (wallaby) {
return {
files: [
'src/**/*.js',
@BoilingOil
BoilingOil / PinchZoomPan.js
Created September 30, 2018 23:45 — forked from iammerrick/PinchZoomPan.js
React Pinch + Zoom + Pan
import React from 'react';
const MIN_SCALE = 1;
const MAX_SCALE = 4;
const SETTLE_RANGE = 0.001;
const ADDITIONAL_LIMIT = 0.2;
const DOUBLE_TAP_THRESHOLD = 300;
const ANIMATION_SPEED = 0.04;
const RESET_ANIMATION_SPEED = 0.08;
const INITIAL_X = 0;