Skip to content

Instantly share code, notes, and snippets.

Avatar

Tachun Lin tachun

View GitHub Profile
@tachun
tachun / keybase.md
Created Sep 10, 2019
keybase prove
View keybase.md

Keybase proof

I hereby claim:

  • I am tachun on github.
  • I am ttvvictor (https://keybase.io/ttvvictor) on keybase.
  • I have a public key ASATWnbM37I39zAYS5hHYQ-S7z4GGxmH2hDj05bOVAOSbgo

To claim this, I am signing this object:

@tachun
tachun / ballot.sol
Last active Dec 29, 2018
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.2+commit.1df8f40c.js&optimize=false&gist=
View ballot.sol
pragma solidity ^0.4.17;
contract Inbox {
string public message;
function Inbox(string initialMessage) public {
message = initialMessage;
}
function setMessage(string newMessage) public {
@tachun
tachun / Why use .js rather than .jsx
Created Dec 16, 2015
Why use .js rather than .jsx
View Why use .js rather than .jsx
Components in the starter kit currently use .js file extension for two reasons:
As of now, it's the default file extension for React components used at Facebook. See react-tools jsx command-line build tool, which ignores .jsx files unless you specified -x jsx parameter. Also see React examples and Flux examples.
You can reference these components in your source code without specifying file extension, e.g. require('./MyComponent') instead of require('./MyComponent.jsx') and still be able to use "navigate to source" feature in your code editor.
Do you think that the benefits of having .jsx file extension for React components outmatch these two?
@tachun
tachun / Why use .js rather than .jsx
Created Dec 16, 2015
Why use .js rather than .jsx
View Why use .js rather than .jsx
Components in the starter kit currently use .js file extension for two reasons:
As of now, it's the default file extension for React components used at Facebook. See react-tools jsx command-line build tool, which ignores .jsx files unless you specified -x jsx parameter. Also see React examples and Flux examples.
You can reference these components in your source code without specifying file extension, e.g. require('./MyComponent') instead of require('./MyComponent.jsx') and still be able to use "navigate to source" feature in your code editor.
Do you think that the benefits of having .jsx file extension for React components outmatch these two?
@tachun
tachun / Redis
Last active Dec 1, 2015
Redis + Homebrew
View Redis
//Let’s install Redis for the good.
$ brew install redis
//Launch Redis on computer starts.
$ ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
//Start Redis server via “launchctl”.
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
//Start Redis server using configuration file.
@tachun
tachun / gulpfile.js
Created Dec 21, 2014
Watchify + Browserify + jade with Google's Web Starter Kit
View gulpfile.js
'use strict';
// Include Gulp & Tools We'll Use
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var del = require('del');
var runSequence = require('run-sequence');
var browserSync = require('browser-sync');
var pagespeed = require('psi');
var reload = browserSync.reload;
@tachun
tachun / Install Phonegap facebook plugin
Last active Aug 29, 2015
Phonegap facebook plugin
View Install Phonegap facebook plugin
After 3hours of gloomy of installation Phonegap facebook plugin, here is a full tuto who save my ass:
1. Follow the Tutorial
[How to install Phonegap Facebook plugin for iOS](http://jbkflex.wordpress.com/2013/03/16/installing-facebook-connect-plugin-with-phonegap-ios-app-for-beginners/)
2. Can't find Cordova.plist instep 18
In the tutorial above, we need to add "org.apache.cordova.facebook.Connect" in , but there is no "Cordova.plist" in phonegap 3, it's replaced by "config.xml", so click right on "config.xml" and open as "Source code" and put this code below in it
<feature name="org.apache.cordova.facebook.Connect">
View ios7-safari-height-issue
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<style>
html { position: fixed; top: 0px; bottom: 0px; width: 100%; }
</style>
</head>
...
<script type="text/javascript">
View Handlebars.js ifvalue
## Javascript
Handlebars.registerHelper('ifvalue', function (conditional, options) {
if (options.hash.value === conditional) {
return options.fn(this)
} else {
return options.inverse(this);
}
});