This file contains hidden or 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
/** | |
* 获取品类树 并 做key-value 映射 | |
*/ | |
getCascaderTree: function(){ | |
var self = this; | |
// 递归 key-value 映射 | |
var recursion = function(children){ | |
if(children && children.length > 0){ | |
return children.map((item)=>{ | |
return { |
This file contains hidden or 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
/** | |
* [email protected] | |
* 2017-05-08 | |
*/ | |
'use strict'; | |
import React, { Component } from 'react'; | |
import { | |
AppRegistry, | |
StyleSheet, |
This file contains hidden or 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
function Car(name){ | |
// this.name = name; | |
if(this instanceof Car){ | |
console.log('has been newed'); | |
this.name = name; | |
}else{ | |
console.log('need newed'); | |
return new Car(name); | |
} |
This file contains hidden or 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
// ==UserScript== | |
// @name 零售页面注入脚本 | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match http://m.retail.st.sankuai.com/* | |
// @run-at document-start | |
// @grant none | |
// ==/UserScript== |
This file contains hidden or 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
function Animal(age) { | |
if (age) { this.age = age; } | |
// 这个name 不会影响 Dog 或者V, 只会影响new Animal的人 | |
this.name= "One Animal" | |
} | |
Animal.prototype.age = 1; | |
Animal.prototype.name= "One Animal"; // 优先级 P3 |
This file contains hidden or 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
/** | |
* React Static Boilerplate | |
* https://github.com/koistya/react-static-boilerplate | |
* Copyright (c) Konstantin Tarkus (@koistya) | MIT license | |
*/ | |
import path from 'path'; | |
import webpack from 'webpack'; | |
import merge from 'lodash.merge'; |
This file contains hidden or 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
// | |
// APerfactDelegate.h | |
// ReactiveCocoaPractice | |
// | |
// Created by mengqian on 20/9/2016. | |
// Copyright © 2016 thinktube. All rights reserved. | |
// | |
#ifndef APerfactDelegate_h | |
#define APerfactDelegate_h |
This file contains hidden or 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
-(void)makeMaskWithFrame:(CGRect)frame | |
{ | |
// Create a mask layer and the frame to determine what will be visible in the view. | |
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; | |
// CGContextFillEllipseInRect(); | |
CGRect maskRect = CGRectMake(0, 0, frame.size.width, frame.size.height); | |
// Create a path with the rectangle in it. | |
CGPathRef path = CGPathCreateWithEllipseInRect(maskRect, NULL); |
This file contains hidden or 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
//开始 | |
RCTPerformanceLoggerStart(RCTPLNativeModuleInit); | |
// 结束 | |
RCTPerformanceLoggerEnd(RCTPLNativeModuleInit); | |
// 手动设置 | |
RCTPerformanceLoggerSet(RCTPLNativeModuleMainThreadUsesCount, modulesOnMainThreadCount); | |
typedef NS_ENUM(NSUInteger, RCTPLTag) { | |
RCTPLScriptDownload = 0, |
This file contains hidden or 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
dispatch_queue_t bridgeQueue = dispatch_queue_create("com.facebook.react.RCTBridgeQueue", DISPATCH_QUEUE_CONCURRENT); | |
dispatch_group_t initModulesAndLoadSource = dispatch_group_create(); | |
// Asynchronously load source code | |
dispatch_group_enter(initModulesAndLoadSource); | |
__weak RCTBatchedBridge *weakSelf = self; | |
__block NSData *sourceCode; | |
[self loadSource:^(NSError *error, NSData *source) { | |
if (error) { |