Skip to content

Instantly share code, notes, and snippets.

View trujunzhang's full-sized avatar

Trujun Zhang trujunzhang

View GitHub Profile
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
;; `+distribution'. For now available distributions are `spacemacs-base'
@trujunzhang
trujunzhang / App.js
Created July 1, 2018 23:11 — forked from gregblass/App.js
Expo/React Navigation - Google Analytics Integration
import React, { Component } from 'react'
import { RootNavigator } from './navigators'
import { GoogleAnalyticsTracker } from './utils/analytics'
import { GA_TRACKING_ID } from './constants'
class App extends Component {
// gets the current screen from navigation state
getCurrentRouteName = (navigationState) => {
if (!navigationState) {
return null
@trujunzhang
trujunzhang / gist:cebcbf43758311ccc22527109d3c9b70
Created June 20, 2018 09:49 — forked from marty-wang/gist:5a71e9d0a6a2c6d6263c
Compile and deploy React Native Android app of Release version to device.
Disclaimer: The instructions are the collective efforts from a few places online.
Nothing here is my original. But I want to put them together in one place to save people from spending the same time as I did.
First off, bundle.
==================
1. cd to the project directory
2. Start the react-native packager if not started
3. Download the bundle to the asset folder:
curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"
@trujunzhang
trujunzhang / react-typescript.md
Created January 16, 2018 12:20 — forked from juhaelee/react-typescript.md
React + Typescript Cheatsheet

React + Typescript Cheatsheet

Setup

If you use atom... download & install the following packages:

What are Typescript type definition files? (*.d.ts)

@trujunzhang
trujunzhang / next_nginx.md
Created December 26, 2017 12:09 — forked from kocisov/next_nginx.md
How to setup next.js app on nginx with letsencrypt

How to setup next.js app on nginx with letsencrypt

next.js, nginx, reverse-proxy, ssl

1. Install nginx and letsencrypt

$ sudo apt-get update
$ sudo apt-get install nginx letsencrypt

Also enable nginx in ufw

@trujunzhang
trujunzhang / rename.sh
Created December 5, 2017 10:43 — forked from mustafaturan/rename.sh
Rename all js files into jsx
for x in *.js; do mv "$x" "${x%.js}.jsx"; done
@trujunzhang
trujunzhang / sample.js
Created November 22, 2017 23:35 — forked from jeffhuangtw/sample.js
Resend Parse User Verification Email Cloud Code
// resend verify email
Parse.Cloud.define("ResendVerifyEmail", function(request, response) {
var user = Parse.User.current();
if (!user) {
response.error("INVALID_USER");
return;
}
var email = request.params.email;
var query = new Parse.Query(Parse.User);
Parse.Cloud.useMasterKey();
@trujunzhang
trujunzhang / imagemagick_problem.sh
Created May 19, 2017 03:48 — forked from ExReanimator/imagemagick_problem.sh
Can't install RMagick 2.16.0. Can't find MagickWand.h
$ brew tap homebrew/versions
$ brew install imagemagick@6
$ PKG_CONFIG_PATH=/usr/local/opt/imagemagick@6/lib/pkgconfig gem install rmagick
@trujunzhang
trujunzhang / 00.howto_install_phantomjs.md
Created November 27, 2016 12:14 — 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