Skip to content

Instantly share code, notes, and snippets.

View tranquan's full-sized avatar
🥝
kiwi

Tran Quan tranquan

🥝
kiwi
View GitHub Profile
@tranquan
tranquan / configure_gradle.py
Last active November 17, 2017 09:38
help to configure node_modules in react native to a same build configs
# help to config node_modules in react native to a same build configs
# the code will loop through every module defie in MODULES and try to modify the build.gradle file
# @copyright tranquan221b@gmail.com
import os
import glob
import re
# ----------------------------------------------------------------------
# FUNCTIONS:
@tranquan
tranquan / vscode_personal_settings.json
Last active July 12, 2018 11:50
vscode setting personal usage
{
"editor.dragAndDrop": false,
"editor.fontSize": 13,
"editor.fontFamily": "Monaco, 'Source Code Pro', Consolas, 'Ubuntu Mono', 'Courier New', monospace, 'Segoe UI Emoji'",
"editor.fontWeight": "100",
"editor.formatOnSave": true,
"editor.tabSize": 2,
"editor.wordWrap": "on",
"editor.wordWrapColumn": 100,
"editor.minimap.enabled": false,
/**
* Auto increment versionCode for every build
* read version.properties in android root directory and auto increment build number on release
*/
def readAndIncrementVersionCode() {
def isRelease = false
List<String> runTasks = gradle.startParameter.getTaskNames();
for (String item : runTasks) {
if (item.contains("assemble") && item.contains("Release")) {
/**
* Thanks to https://github.com/danleveille/react-native-input-accessory-demo
*/
import React, { Component } from 'react';
import {
Dimensions,
TouchableOpacity,
LayoutAnimation,
StyleSheet,
Keyboard,
createTimeMoment() {
if (!this.mCreateTimeMoment) {
this.mCreateTimeMoment = moment(this.createTime, 'X');
}
return this.mCreateTimeMoment;
}
# configure app name (in strings.xml) & firebase info google-services.json
# to match with the environment setting in app/constants/configs.js
# *** developer still have to config the applicationId manually ***
import os
import glob
import re
from shutil import copyfile
# Contants
@tranquan
tranquan / swift_closure.md
Created January 6, 2018 09:14
A Summary and Best practices of Closure in Swift

Documents

What is closure?

Closures are self-contained blocks of functinality that can be PASSED around and USED in your code

@tranquan
tranquan / react_native_vscode_workspace_settings.json
Last active July 12, 2018 11:51
vscode workspace settings for react-native project
{
"eslint.enable": false,
"tslint.enable": false,
"editor.formatOnSave": true,
"editor.tabSize": 2,
"editor.wordWrap": "on",
"editor.wordWrapColumn": 100,
"editor.parameterHints": false,
"editor.rulers": [100],
"typescriptHero.imports.disableImportRemovalOnOrganize": false,
@tranquan
tranquan / reactotron_log_config.ts
Last active July 30, 2018 18:58
Reactotron Log Configure to connect Console.log
/**
* Copyright (C) SaigonMD, Inc - All Rights Reserved
* Licensed under the MIT license.
* Written by Tran Quan <tranquan221b@gmail.com>, July 2018
*/
/**
* Log helper using Reactotron https://github.com/infinitered/reactotron
* - log faster than console because no need to turn-on remote debug
* - able to customize the message
*/
@tranquan
tranquan / OverriddenPublishedContent.cs
Created November 12, 2018 16:32
A way to override property in umbraco
// source: https://www.formfakten.de/themen/2018/08/published-content-with-overridden-properties
public class OverriddenProperty : IPublishedProperty
{
private readonly string alias;
private readonly object value;
public OverriddenProperty(string alias, object value)
{
this.alias = alias;
this.value = value;