Skip to content

Instantly share code, notes, and snippets.

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

ezio ruan ezioruan

🏠
Working from home
View GitHub Profile
1: model 数据库设计
```
module.exports = function(sequelize, DataTypes) {
return sequelize.define('payment', {
id: {
type: DataTypes.INTEGER(10).UNSIGNED,
allowNull: false,
primaryKey: true,
autoIncrement: true
@ezioruan
ezioruan / imagemagick.bash
Created October 17, 2017 05:52 — forked from bensie/imagemagick.bash
ImageMagick Static Binaries for AWS Lambda
#!/usr/bin/env bash
# Must be run on an Amazon Linux AMI that matches AWS Lambda's runtime
# As of Nov 23, 2015, this is Amazon Linux AMI 2014.09.2 x86_64 (ami-0c682c64)
#
# Lambda includes ImageMagick 6.7.8-9 preinstalled, so you need to prepend PATH
# with the folder containing these binaries in your Lambda function to ensure
# these newer binaries are used.
sudo yum -y install libpng-devel libjpeg-devel libtiff-devel gcc
@ezioruan
ezioruan / README.md
Created August 30, 2017 02:38 — forked from lopezjurip/README.md
OSX Homebrew: docker-machine setup

Prerequisites

Make sure you have installed Homebrew and (Homebrew-Cask)[http://caskroom.io/].

# Install Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

# Install Homebrew-cask
brew install caskroom/cask/brew-cask
/**
* @providesModule PatientList
*/
import NavigationBar from 'react-native-navbar';
import NavigationButtons from 'NavigationButtons';
import React, { ListView, Navigator, StyleSheet, Text, TextInput, TouchableHighlight, View } from 'react-native';
import { connect } from 'react-redux/native'
@connect(state => ({
patients: state.patients
@ezioruan
ezioruan / promise_while_loop.js
Created July 27, 2016 05:34 — forked from victorquinn/promise_while_loop.js
Promise "loop" using the Bluebird library
var Promise = require('bluebird');
var promiseWhile = function(condition, action) {
var resolver = Promise.defer();
var loop = function() {
if (!condition()) return resolver.resolve();
return Promise.cast(action())
.then(loop)
.catch(resolver.reject);
@ezioruan
ezioruan / keyrepeat.shell
Last active June 5, 2016 01:13 — forked from kconragan/keyrepeat.shell
Enable key repeat in OS X EL Capitan for Deco ide in Vim mode
# Mac OS X EL Capitanintroduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Deco ide if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
@ezioruan
ezioruan / pre-commit
Created April 12, 2016 01:25 — forked from tmaiaroto/pre-commit
A Go Commit Hook for Less Future Headaches
#!/bin/bash
#
# Check a "few" things to help write more maintainable Go code.
#
# OK, it's fairly comprehensive. So simply remove or comment out
# anything you don't want.
#
# Don't forget to install (go get) each of these tools.
# More info at the URLs provided.
#
@ezioruan
ezioruan / analyticsdumper.go
Created April 11, 2016 03:39 — forked from rickt/analyticsdumper.go
example Go code showing how to download reporting data from Google Analytics using the Core Reporting API, a Google service account + oauth2 (UPDATE: go here http://code.rickt.org/post/142445693275/updated-golang-code-to-query-ga-data-via-the instead)
//
// NOTE: go here for an update http://code.rickt.org/post/142445693275/updated-golang-code-to-query-ga-data-via-the
// this gist still works but has a lot of extra fluff you don't need
// http://code.rickt.org/post/142445693275/updated-golang-code-to-query-ga-data-via-the is what you really want
//
package main
import (
"flag"
"fmt"
"golang.org/x/oauth2"
@ezioruan
ezioruan / alfred-pinyin.py
Created February 14, 2016 06:20 — forked from tiann/alfred-pinyin.py
make alfred support pinyin search
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# @author weishu @2015/12/7
import subprocess
import os
import re
import json
<!-- test pass with CryptoJS v3.1.2 -->
<script src="rollups/tripledes.js"></script>
<script src="components/mode-ecb.js"></script>
<script>
/**
* Encrypt message by DES in ECB mode and Pkcs7 padding scheme
*
* NOTE: DES is weak, please use 3DES(Triple DES) or AES
*
* @param {String} message