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 PictureUploader < CarrierWave::Uploader::Base | |
include CarrierWave::MiniMagick | |
storage :file | |
def store_dir | |
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" | |
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
存取照片或相機時可能會遇到,通常是權限的問題,所以在info.plist中增加額外的key來處理 | |
1. 增加 Privacy - Camera Usage Description, value的部分寫個為何要使用的理由 | |
2. 增加 Privacy - Photo Library Usage Description, value的部分寫個為何要使用的理由 | |
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
{ '基隆市': | |
[ '仁愛區200', | |
'信義區201', | |
'中正區202', | |
'中山區203', | |
'安樂區204', | |
'暖暖區205', | |
'七堵區206' ], | |
'臺北市': | |
[ '中正區100', |
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
# In model: | |
# include LangMapping | |
# | |
# lang_map({ | |
# status: [[:enabled, 1, "啟動"], [:disabled, 2, "取消"], [:unauthenticated, 0, "註冊中"]], | |
# user_type: [[:standard, 0, "標準"], [:vip, 1, "高級"], [:vvip, 2, "最高級"], [:admin, 3, "管理員"]] | |
# }) | |
# 會產生 class methods: all_xxxxs, instance methods: show_xxxx 2個方法 | |
# 例如 user.show_status 會出現"啟動"、"取消"或"註冊中" |
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 React, { Component } from 'react'; | |
import { Text, View } from 'react-native'; | |
export default class App extends Component { | |
constructor(props) { | |
super(props); | |
} | |
render() { | |
return ( | |
<Child value="我是子元素" /> | |
); |
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 React, { Component } from 'react'; | |
import { Text, View } from 'react-native'; | |
export default class App extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
factor1: 2, | |
factor2: 5, | |
} | |
} |
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 React, { Component } from 'react'; | |
import { Text, View } from 'react-native'; | |
export default class App extends Component { | |
constructor(props) { | |
super(props); | |
} | |
render() { | |
return ( | |
<View style={{flex: 1, flexDirection: 'column'}}> | |
<View style={{flex: 1, |
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
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}> | |
<Text style={ | |
{ | |
color: '#cc0000', | |
fontSize: 40, | |
textDecorationLine: 'underline', | |
textDecorationColor: 'blue', | |
textShadowColor: 'black', | |
textShadowOffset: { | |
width: 2, |
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 React, { Component } from 'react'; | |
import { View, TextInput } from 'react-native'; | |
export default class App extends Component { | |
constructor(props) { | |
super(props); | |
console.log("constructor"); | |
} | |
componentWillMount() { | |
console.log("component will mount"); | |
} |
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 React, { Component } from 'react'; | |
import { View, TextInput } from 'react-native'; | |
export default class App extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
value: null | |
} | |
} | |
componentWillReceiveProps() { |