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
function throttle(type, name, obj) { | |
var running = false; | |
obj = obj || window; | |
var func = function() { | |
if (running) return; | |
running = true; |
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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
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 { createElement } from 'react' | |
import { renderToString } from 'react-dom/server' | |
export default function renderHookServer( | |
hookInit: Function | |
): // eslint-disable-next-line @typescript-eslint/no-explicit-any | |
any { | |
let hookOutput = undefined | |
function HookWrapper() { |
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
'use strict' | |
var join = require('path').join | |
var plan = require('flightplan') | |
const application = 'example.com' | |
const deployTo = join('/var', 'www', application) | |
const repoUrl = 'https://github.com/example/example.git' | |
const branch = 'master' | |
const keepReleases = 3 |
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
@mixin position($position, $args: null) { | |
$offsets: bottom left right top; | |
position: $position; | |
@if (type-of($args) == 'list') { | |
@each $offset in $offsets { // 3 | |
$index: index($args, $offset); // 4 | |
@if $index { // 5 |
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
$bem-element-separator: '__' !default; | |
$bem-modifier-separator: '--' !default; | |
// BEM: Block (New) | |
@mixin new($name, $description) { | |
/** | |
* #{$name} | |
* #{$description} | |
*/ | |
.#{$name} { |
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
// Utility to check if value is a Promise | |
function isPromise(value) { | |
if (value !== null && typeof value === 'object') { | |
return value && typeof value.then === 'function' | |
} | |
return false | |
} | |
// Cache |
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
export const mapDispatchToProps = actions => dispatch => Object.keys(actions).reduce((obj, key) => { | |
obj.actions[key] = bindActionCreators(actions[key], dispatch) | |
return obj | |
}, { actions: {} }) | |
// connect(null, mapDispatchToProps({ action1, action2 }))(ReactComponent) | |
// => this.props.actions.action1, this.props.actions.action2 | |
export const mapStateToProps = properties => store => properties.reduce((obj, property) => { | |
if (store.hasOwnProperty(property)) { |
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
CHARACTER_MAP = | |
'À':'A', 'Á':'A', 'Â':'A', 'Ã':'A', 'Ä':'A', 'Å':'A', 'Æ':'AE', 'Ç':'C', | |
'È':'E', 'É':'E', 'Ê':'E', 'Ë':'E', 'Ì':'I', 'Í':'I', 'Î':'I', 'Ï':'I', | |
'Ð':'D', 'Ñ':'N', 'Ò':'O', 'Ó':'O', 'Ô':'O', 'Õ':'O', 'Ö':'O', 'Ő':'O', | |
'Ø':'O', 'Ù':'U', 'Ú':'U', 'Û':'U', 'Ü':'U', 'Ű':'U', 'Ý':'Y', 'Þ':'TH', | |
'ß':'ss', 'à':'a', 'á':'a', 'â':'a', 'ã':'a', 'ä':'a', 'å':'a', 'æ':'ae', | |
'ç':'c', 'è':'e', 'é':'e', 'ê':'e', 'ë':'e', 'ì':'i', 'í':'i', 'î':'i', | |
'ï':'i', 'ð':'d', 'ñ':'n', 'ò':'o', 'ó':'o', 'ô':'o', 'õ':'o', 'ö':'o', | |
'ő':'o', 'ø':'o', 'ù':'u', 'ú':'u', 'û':'u', 'ü':'u', 'ű':'u', 'ý':'y', | |
'þ':'th', 'ÿ':'y', '©':'(c)', 'α':'a', 'β':'b', 'γ':'g', 'δ':'d', 'ε':'e', |
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
// | |
// Base58 Encode/Decode Trait for PHP | |
// ================================== | |
// Base58 is like Base62 except that it removes certain problematic characters such as 0, O, I, and l. | |
// This is great if you need the encoded output to be easily human-readable. Like short URLs... | |
// | |
trait Base58 { | |
private $alphabet = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'; |
NewerOlder