This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*******************************************************************************/ | |
/* | |
* Get Touch Event For Android | |
* record 4 coordinate | |
* 1. Touch_old_x -> touchstart x | |
* 2. Touch_old_y -> touchstart y | |
* 3. Touch_new_x -> touchmove x | |
* 4. Touch_new_x -> touchmove y | |
*/ | |
var Touch_old_x = 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
# helper_name:inspect_helper | |
# author: Whien_Liou | |
# time: 2014/07/23 | |
# | |
# usage | |
# 請在增加 config/initializers/inspect_helper.rb | |
# 加入下列幾行代碼 | |
# 在 controller 使用 | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Cart < ActiveRecord::Base | |
has_many :cart_items, :dependent => :destroy | |
has_many :items, :through => :cart_items, :source => :product | |
def add_product_to_cart(product) | |
items << product | |
end | |
def update_quantity_to_cart(product_id, quantity, current_cart_id) | |
## do something.. | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "map-note", | |
"version": "1.0.0", | |
"description": "the map note project", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"repository": { | |
"type": "git", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require('path'); | |
var webpack = require('webpack'); | |
module.exports = { | |
entry: { | |
app: [ './app/main.react.js' ], | |
vendors: [ 'webpack-dev-server/client?http://localhost:8080', 'webpack/hot/only-dev-server' ] | |
}, | |
output: { | |
path: path.resolve(__dirname, 'build'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"parser": "babel-eslint", | |
"extends": "eslint-config-airbnb", | |
"plugins": ["react"], | |
"env": { | |
"browser": true, | |
"node": true, | |
"es6": true, | |
"jest": true | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Api::BaseController < ActionController::API | |
respond_to :json | |
# before_action :set_origin | |
# before_action :set_headers | |
before_filter :set_cors_header | |
after_filter :cors_set_access_control_headers | |
def cors_set_access_control_headers | |
headers['Access-Control-Allow-Origin'] = '*' | |
headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Im from 'immutable'; | |
export default class ImUtil { | |
/* | |
* new Map() | |
*/ | |
setEmptyMap = (obj, cursor) => { | |
return obj.setIn(cursor, new Im.Map()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"presets": ["react", "es2015"] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
module.exports = { | |
entry: [ | |
'./src/index.react.js' | |
], | |
output: { | |
path: path.resolve(__dirname, 'build'), | |
filename: 'bundle.js', | |
publicPath: 'build' |
OlderNewer