Skip to content

Instantly share code, notes, and snippets.

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

Cuong Lam thanhcuong1990

🏠
Working from home
View GitHub Profile
@thanhcuong1990
thanhcuong1990 / App.jsx
Created August 22, 2018 08:04 — forked from ilya-uryupov/App.jsx
React-Native copy-paste'able multiline TextInput inside ViewPagerAndroid
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react'
import { StyleSheet, Text, TextInput, View, ViewPagerAndroid } from 'react-native'
const rnVersion = '0.52.0'
@thanhcuong1990
thanhcuong1990 / learning.md
Created June 25, 2018 11:17 — forked from sibelius/learning.md
Learning Path React Native

Basics

  • Learn how to start a new react native project
  • Run it on ios simulator, on android emulator, on a real iPhone device and on a real Android device, with and without debugging enabled.
  • Learn how to upgrade a react native project
  • Learn how to add a package to the project
  • Learn how to add a package that has a native dependency (https://github.com/airbnb/react-native-maps, https://github.com/evollu/react-native-fcm) - DO NOT USE COCOAPODS
  • Learn how to use fetch to get data from your backend

Learn Navigation

@thanhcuong1990
thanhcuong1990 / react-native-router-flux-android-back-button.js
Created June 18, 2017 17:01 — forked from yanqiw/react-native-router-flux-android-back-button.js
react-native-router-flux, handle android back button event.
import { BackAndroid } from 'react-native';
import {Reducer} from 'react-native-router-flux';
backButtonPressedOnceToExit = false;
let currentSceneName = null;
const reducerCreate = params=>{
const defaultReducer = Reducer(params);
return (state, action)=>{
console.info("reducerCreate.{state,action}", state, action);
@thanhcuong1990
thanhcuong1990 / install-comodo-ssl-cert-for-nginx.rst
Created November 20, 2015 14:30 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@thanhcuong1990
thanhcuong1990 / Badge.swift
Created November 14, 2015 13:56 — forked from yonat/Badge.swift
Rounded UILabel and UIButton, Badged UIBarButtonItem
//
// Badge.swift
// Extensions for Rounded UILabel and UIButton, Badged UIBarButtonItem.
//
// Created by Yonat Sharon on 06.04.2015.
// Copyright (c) 2015 Yonat Sharon. All rights reserved.
//
import UIKit
@thanhcuong1990
thanhcuong1990 / 00.howto_install_phantomjs.md
Created September 24, 2015 16:08 — forked from julionc/00.howto_install_phantomjs.md
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
@thanhcuong1990
thanhcuong1990 / deploy.rb
Created September 24, 2015 09:59 — forked from stas/deploy.rb
Mina Deploy Task (Rails + Puma + Delay Job + rbenv)
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rbenv' # for rbenv support. (http://rbenv.org)
# require 'mina/rvm' # for rvm support. (http://rvm.io)
# Basic settings:
# domain - The hostname to SSH to.
# deploy_to - Path to deploy into.
# repository - Git repo to clone from. (needed by mina/git)
@interface NSFileManager (DoNotBackup)
- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL;
@end
import UIKit
import Security
class Keychain {
class func save(key: String, data: NSData) -> Bool {
let query = [
kSecClass as String : kSecClassGenericPassword as String,
kSecAttrAccount as String : key,
kSecValueData as String : data ]
# db/migrate/XXXXXXXXXXXXX_add_authentication_token_to_users.rb
class AddAuthenticationTokenToUsers < ActiveRecord::Migration
def change
add_column :users, :authentication_token, :string
add_index :users, :authentication_token, :unique => true
end
end