Skip to content

Instantly share code, notes, and snippets.

@OutThisLife
OutThisLife / tween.js
Created January 24, 2018 18:49
Tween between two numbers and return the value as it updates.
import eases from 'eases'
const defaults = {
start: 0,
to: 0,
speed: 650,
easing: 'sineOut',
onUpdate: () => {},
handleEnd: () => {},
handleStart: () => {}
const log = new Proxy({}, {
get: (_, colour) => function() {
console.log(`%c ${[].slice.call(arguments).join(' ')}`, `color: ${colour}`)
}
})
// example
log.tomato('I am tomato')
log.chocolate('I am chocolate')
log.cornflowerblue('I am cornflowerblue')
@OutThisLife
OutThisLife / cloudSettings
Last active September 25, 2020 00:11
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-09-25T00:11:19.988Z","extensionVersion":"v3.4.3"}
<?php
add_action('rest_api_init', function() {
register_rest_field(get_post_types(), 'fields', [
'get_callback' => function($post) {
return CFS()->get();
},
]);
});
import express from 'express'
const
port = process.env.PORT || 3000,
app = express()
// -----------------------------------------------
app.listen(port, () => console.log('Listening on port', port))
@OutThisLife
OutThisLife / server-react.js
Last active July 20, 2017 16:20
SSR react
import React from 'react'
import { renderToString } from 'react-dom/server'
import express from 'express'
import Homepage from './src/pages/home'
const
port = process.env.PORT || 3000,
app = express()
// -----------------------------------------------
{
// A File Icon Preferences – User
// ================================================================
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// ! PLEASE RESTART SUBLIME TEXT FOR THESE CHANGES TO TAKE EFFECT !
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
}
{
"user": {
"debug": false,
"delay": 0,
"error_color": "D02000",
"gutter_theme": "Packages/Boxy Theme/extras/SublimeLinter/Boxy.gutter-theme",
"gutter_theme_excludes": [],
"lint_mode": "background",
"linters": {
"eslint": {
@OutThisLife
OutThisLife / AnimateOut.js
Created December 22, 2016 22:49
Fix for iOS back/forward button when using CSS animations to load in and out the content.
const $container = document.getElementById('container')
window.onpageshow = (e) => e.persisted ? window.location.reload() : null
export default function(href) {
document.body.classList.remove('load-in')
document.body.classList.add('load-out')
;['animationend', 'webkitAnimationEnd'].map(evt => {
$container.addEventListener(evt, (e) => {