| Method | Side effects1 | State updates2 | Example uses |
|---|---|---|---|
| Mounting | |||
componentWillMount |
✓ | Constructor equivalent for createClass |
|
render |
Create and return element(s) | ||
componentDidMount |
✓ | ✓ | DOM manipulations, network requests, etc. |
| Updating | |||
componentWillReceiveProps |
✓ | Update state based on changed props |
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
| <!DOCTYPE HTML> | |
| <html> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title>Semantic UI CDN</title> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.9/semantic.min.css"/> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.9/semantic.min.js"></script> | |
| </head> | |
| <body> |
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
| import provinces from 'china-division/dist/provinces.json'; | |
| import cities from 'china-division/dist/cities.json'; | |
| import areas from 'china-division/dist/areas.json'; | |
| areas.forEach((area) => { | |
| const matchCity = cities.filter(city => city.code === area.cityCode)[0]; | |
| if (matchCity) { | |
| matchCity.children = matchCity.children || []; | |
| matchCity.children.push({ | |
| label: area.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
| # maybe.py - a Pythonic implementation of the Maybe monad | |
| # Copyright (C) 2014. Milan Oberkirch <milan.py@oberkirch.org> | |
| # Copyright (C) 2014. Senko Rasic <senko.rasic@goodcode.io> | |
| # | |
| # 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: |
Vanilla Throttle esnextbin
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
| # coding: utf8 | |
| """ Attempt at gevent-compatible requests without any monkeypatching """ | |
| import geventhttpclient | |
| from geventhttpclient import httplib as gehttplib | |
| from geventhttpclient.useragent import CompatResponse | |
| import httplib as _httplib | |
| import requests |
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
| public extension Int { | |
| public var seconds: DispatchTimeInterval { | |
| return DispatchTimeInterval.seconds(self) | |
| } | |
| public var second: DispatchTimeInterval { | |
| return seconds | |
| } | |
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
| # 你可以从该 URL 下载这个配置文件: http://surge.run/config-example/ios.conf | |
| # 用编辑器编辑后,再通过 iTunes, URL, AirDrop 或者 iCloud Drive 复制回 iOS 设备 | |
| # Version 2.0 | |
| [General] | |
| # 日志等级: warning, notify, info, verbose (默认值: notify) | |
| loglevel = notify | |
| # 跳过某个域名或者 IP 段,这些目标主机将不会由 Surge Proxy 处理。(在 macOS | |
| # 版本中,如果启用了 Set as System Proxy, 那么这些值会被写入到系统网络代理 | |
| # 设置中.) |
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
| exportEvernote() | |
| on exportEvernote() | |
| set outputDir to (do shell script "echo ~/Downloads/") | |
| set theDate to current date | |
| set timeStamp to (do shell script "date +'%y-%m-%d-%T'") | |
| tell application "Evernote" |
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
| import React from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| import { Events, UICorePlugin } from 'clappr'; | |
| class MyComponent extends React.Component { | |
| render() { | |
| return <div>Hello World!</div> | |
| } | |
| } |