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
# When using RN in combination with Cocoapods, a lot of | |
# things are broken. These are the fixes we had to append | |
# to our Podfile when upgrading to ReactNative@0.55.3. | |
# | |
# WARNING: Check those line numbers when you're on a different version! | |
def change_lines_in_file(file_path, &change) | |
print "Fixing #{file_path}...\n" | |
contents = [] |
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
// FaiChou | |
// willMount add | |
// willUnmount remove | |
const __notices = []; // eslint-disable-line | |
const isDebug = true; | |
// register notification,name: notification name,selector: function for action to do,observer: type Object | |
export const addNotification = (name, selector, observer) => { |
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
// This is an example of how to fetch external data in response to updated props, | |
// If you are using an async mechanism that does not support cancellation (e.g. a Promise). | |
class ExampleComponent extends React.Component { | |
_currentId = null; | |
state = { | |
externalData: null | |
}; |
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 PropTypes from 'prop-types'; | |
import React from 'react'; | |
import { | |
View, | |
Easing, | |
Animated, | |
StyleSheet, | |
Dimensions, | |
ViewPropTypes, | |
} from 'react-native'; |
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 { join } from 'path' | |
import { readdir, stat } from 'fs-promise' | |
async function rreaddir (dir, allFiles = []) { | |
const files = (await readdir(dir)).map(f => join(dir, f)) | |
allFiles.push(...files) | |
await Promise.all(files.map(async f => ( | |
(await stat(f)).isDirectory() && rreaddir(f, allFiles) | |
))) | |
return allFiles |
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
------------------------------commit------------------------------ | |
$ git status # 检查文件当前的状态 | |
$ git add [文件名] # 追踪新的文件 | |
$ git diff --cached # 若要看已经暂存起来的文件和上次提交时的快照之间的差异 | |
$ git commit -m "Story 182: Fix benchmark" # 用一行命令提交更新 | |
$ git commit -a -m 'added new benchmarks' # 跳过add命令直接提交 | |
$ git rm --cached log.log # 从git仓库中删除不小心追踪的文件(用于gitignore之前追踪的文件) | |
$ git mv file_from file_to # 移动文件/重命名文件 | |
------------------------------branch------------------------------ |
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 debug = process.env.NODE_ENV !== "production"; | |
var webpack = require('webpack'); | |
module.exports = { | |
context: __dirname, | |
devtool: debug ? "inline-sourcemap" : null, | |
entry: "./js/scripts.js", | |
output: { | |
path: __dirname + "/js", | |
filename: "scripts.min.js" |
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 uniqueArray = function(arrArg) { | |
return arrArg.filter(function(elem, pos,arr) { | |
return arr.indexOf(elem) == pos; | |
}); | |
}; | |
var uniqEs6 = (arrArg) => { | |
return arrArg.filter((elem, pos, arr) => { | |
return arr.indexOf(elem) == pos; | |
}); |
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
<!DOCTYPE html> <!-- 使用 HTML5 doctype,不区分大小写 --> | |
<html lang="zh-cmn-Hans"> <!-- 更加标准的 lang 属性写法 http://zhi.hu/XyIa --> | |
<head> | |
<!-- 声明文档使用的字符编码 --> | |
<meta charset='utf-8'> | |
<!-- 优先使用 IE 最新版本和 Chrome --> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/> | |
<!-- 页面描述 --> | |
<meta name="description" content="不超过150个字符"/> | |
<!-- 页面关键词 --> |
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
Copyright 2015 Chris Eidhof | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHE |
NewerOlder