Skip to content

Instantly share code, notes, and snippets.

View Leechael's full-sized avatar
🐹
Working from home

Leechael Leechael

🐹
Working from home
View GitHub Profile
@bvaughn
bvaughn / react-lifecycle-cheatsheet.md
Last active March 2, 2023 13:29
React lifecycle cheatsheet

React lifecycle cheatsheet

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
@Leechael
Leechael / maybe.py
Last active December 29, 2016 04:34 — forked from zvyn/maybe.py
# 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:
@peduarte
peduarte / esnextbin.md
Last active February 18, 2021 21:35
Vanilla Throttle
# 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
public extension Int {
public var seconds: DispatchTimeInterval {
return DispatchTimeInterval.seconds(self)
}
public var second: DispatchTimeInterval {
return seconds
}
# 你可以从该 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, 那么这些值会被写入到系统网络代理
# 设置中.)
@activescott
activescott / export evernote notebooks.scpt
Created July 1, 2016 01:02
Export All Evernote Notebooks
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"
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>
}
}
@zbyte64
zbyte64 / async_app.py
Created May 26, 2016 20:47
Asyncio Views With Django
import asyncio
from django import http
from django.core.urlresolvers import set_script_prefix
from django.utils.encoding import force_str
from django.core.handlers.wsgi import get_script_name
from django_wsgi.handler import DjangoApplication
import logging
import logging
import sys
@addyosmani
addyosmani / pwas.md
Last active June 10, 2020 18:30
💄💋 Progressive Web Apps across popular frameworks that I have written or contributed significantly to

React HN (Universal rendering, Offline caching, optimisations)

React + Webpack application using the PRPL pattern