Skip to content

Instantly share code, notes, and snippets.

@catchin
catchin / MultilineTextInput.js
Last active July 31, 2018 04:07
This is a workaround for the buggy react-native TextInput multiline on Android. Inspired by the comments on https://github.com/facebook/react-native/issues/12717.
import React, {PropTypes, PureComponent} from 'react';
import {TextInput} from 'react-native';
import debounce from 'debounce';
/**
* This is a workaround for the buggy react-native TextInput multiline on Android.
*
* Can be removed once https://github.com/facebook/react-native/issues/12717
* is fixed.
*
@viperwarp
viperwarp / ReactNativeJson.java
Created February 24, 2016 03:02
React-Native Module, ReadableMap/Array to Java JSON objects
private static WritableMap convertJsonToMap(JSONObject jsonObject) throws JSONException {
WritableMap map = new WritableNativeMap();
Iterator<String> iterator = jsonObject.keys();
while (iterator.hasNext()) {
String key = iterator.next();
Object value = jsonObject.get(key);
if (value instanceof JSONObject) {
map.putMap(key, convertJsonToMap((JSONObject) value));
} else if (value instanceof JSONArray) {
/*
* Copyright 2014 shannah.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@sma
sma / README.md
Last active July 4, 2023 06:28
This is an ad-hoc Java-to-Dart translator written in three days. This is version 2 which some bug fixes.

Java to Dart

This is an ad-hoc Java-to-Dart translator originally written on two (admittedly long) evenings.

See http://sma.github.io/stuff/java2dartweb/java2dartweb.html for a demo.

Note: It doesn't support the complete Java grammar specification and cannot translate everything. It only translates syntax and does not attempt to translate Java library classes and methods to Dart equivalents (with the exception of String.charAt and StringBuffer.append). You will have to make changes to the resulting Dart code. It does not support anonymous inner classes.

However, I was able to successfully convert a 7000+ line command line application with only minimal fixes in 30 minutes.

@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream