Skip to content

Instantly share code, notes, and snippets.

@jamesnocentini
jamesnocentini / example.java
Created October 1, 2018 15:41
Avoid React Native Navigation being stuck on the splash screen (noticed with API > 23)
import android.view.View;
import com.reactnativenavigation.controllers.SplashActivity;
public class MainActivity extends SplashActivity {
@Override
public View createSplashLayout() {
return super.createSplashLayout();
}
@jamesnocentini
jamesnocentini / example.js
Last active October 2, 2018 04:49
Set menu bar button item with React Native Navigation and navigate to new page
import React from 'react';
export default class Calculator extends React.Component {
constructor(props) {
super(props);
this.props.navigator.setButtons({
rightButtons: [
{
@jamesnocentini
jamesnocentini / example.js
Created October 1, 2018 05:19
Suppress React Native warnings
import { YellowBox } from 'react-native';
YellowBox.ignoreWarnings([
'<InputAccessoryView> is not supported on Android yet.'
]);
@jamesnocentini
jamesnocentini / example.bash
Last active September 29, 2018 16:34
Install Node.js module from repository
npm install https://github.com/jamiltz/react-native-navigation.git --save
@jamesnocentini
jamesnocentini / .bash_profile
Created September 29, 2018 13:36
Customize command prompt
export PS1="\[\033[48;5;95;38;5;214m\]\W\[\033[m\]\n$ "
@jamesnocentini
jamesnocentini / instructions.adoc
Last active September 29, 2018 13:37
Show dot files in Finder

Show dot files

  1. Shortcut CMD + SHIFT + .

@jamesnocentini
jamesnocentini / example.bash
Created September 29, 2018 12:22
Bash commands
# Print first x lines
ls -la ~ | head -n 12
@jamesnocentini
jamesnocentini / example.java
Last active September 27, 2018 17:29
Native Module stubs to match a JavaScript method call
@ReactMethod
private void queryBookmarkIds(Callback errorCallback, Callback successCallback) {
successCallback.invoke(Arguments.createArray());
}
@jamesnocentini
jamesnocentini / example.java
Last active September 27, 2018 17:13
Print query results to console
Log.d("results", resultSet.allResults().get(0).toMap().toString());
// => suggestion: it would be good if we didn't have to use `toMap().toString()` to print useful information to the console
@jamesnocentini
jamesnocentini / example.java
Last active September 27, 2018 18:58
For-loop with Index
ResultSet resultSet = query.execute();
List<Result> list = resultSet.allResults();
// suggestion: the 2nd line actually mutates resultSet. Should call `allResults() only once!