-
Override preview link in functions.php
function custom_preview_post_link($link, $_post = null) { global $post; $post = $_post ? $_post : $post;
if($post->post_type == 'revision') {
import { useEffect, useMemo, useState, useCallback } from "react"; | |
import useQueryString from "./useQueryString"; | |
function useQueryStringWithIndexValue(key, initialIndex, values) { | |
const computedValues = useMemo(() => values.map(v => v.toLowerCase()), [ | |
values | |
]); | |
const [value, onSetValue] = useQueryString(key, values[initialIndex]); | |
const [index, setIndex] = useState(initialIndex); |
This is a CFP for ReactiveConf 2017's open call for Lightning talks. If you'd like to see this talk become a reality, please ⭐ star this gist. #ReactiveConf
// getComponent is a function that returns a promise for a component | |
// It will not be called until the first mount | |
function asyncComponent(getComponent) { | |
return class AsyncComponent extends React.Component { | |
static Component = null; | |
state = { Component: AsyncComponent.Component }; | |
componentWillMount() { | |
if (!this.state.Component) { | |
getComponent().then(Component => { |
This gist had a far larger impact than I imagined it would, and apparently people are still finding it, so a quick update:
(async main(){...}())
as a substitute for TLA. This completely eliminates the blocking problem (yay!) but it's less powerful, and harder to statically analyse (boo). In other words the lack of TLA is causing real problemsI'll leave the rest of this document unedited, for archaeological
import React from 'react'; | |
const MIN_SCALE = 1; | |
const MAX_SCALE = 4; | |
const SETTLE_RANGE = 0.001; | |
const ADDITIONAL_LIMIT = 0.2; | |
const DOUBLE_TAP_THRESHOLD = 300; | |
const ANIMATION_SPEED = 0.04; | |
const RESET_ANIMATION_SPEED = 0.08; | |
const INITIAL_X = 0; |
//- | |
//- Srcset mixin | |
//- @requires site.data.images | |
//- https://ericportis.com/posts/2014/srcset-sizes/ | |
//- | |
mixin image(src,alt) | |
//- 1: | |
//- Set initial vars |
// Would be ridiculous to pull in the entire moment.js library for this | |
window.moment = function(dateString) { | |
var date = new Date(dateString); | |
var format = function() { | |
return date.getFullYear() + '-' + | |
('0' + (date.getMonth() + 1)).slice(-2) + '-' + | |
('0' + date.getDate()).slice(-2); | |
}; |
Since modern.ie released vagrant boxes, it' no longer necessary to manually import the ova file to virtualbox, as mentioned here.
However, the guys at modern.ie didn't configured the box to work with WinRM. This how-to addresses that, presenting steps to proper repackage these boxes, adding WinRM support. Additionally configures chocolatey package manager and puppet provisioner.