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
#!/bin/bash | |
# CHANGE THESE | |
auth_email="user@example.com" | |
auth_key="" # found in cloudflare account settings | |
zone_name="example.com" | |
record_name="www.example.com" | |
# MAYBE CHANGE THESE | |
# ip=$(curl -s http://ipv4.icanhazip.com) |
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 produce from 'immer' | |
export function createReducer(initialState = {}, handlers) { | |
return (state = initialState, action) => | |
produce(state, draft => { | |
const handler = (action && action.type) ? handlers[action.type] : null | |
if (!handler) { | |
return state | |
} | |
return handler(draft, action) |
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
// 为内置 Map 类型扩展 getIn 和 setIn 方法 | |
Map.prototype.getIn = function getIn(keys, defaultValue) { | |
var value = this | |
for (var key of keys) { | |
value = this.get(key) | |
if (!value) { | |
return defaultValue | |
} | |
} | |
return value |