A Pen by Peter Sharp on CodePen.
A Pen by Peter Sharp on CodePen.
A Pen by Peter Sharp on CodePen.
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
<?php | |
const VERSION = '0.0.1'; | |
const PRFX = 'plugin_'; | |
function plugin_update() { | |
if ( get_site_option( PRFX.'version' ) == VERSION ) return; | |
do_action(PRFX.'update'); | |
update_site_option( PRFX.'version', VERSION ); |
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
// ⇒ function | |
function instantiate(bytes, imports) { | |
return WebAssembly.compile(bytes).then(m => new WebAssembly.Instance(m, imports)); | |
} | |
var importObject = { imports: { bestTime: arg => console.log(arg) } }; | |
fetch('getSuitableDay.wasm').then(response => response.arrayBuffer()) | |
.then(bytes => instantiate(bytes, importObject)) |
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
<form action=""> | |
<input type="date" class="js-date" placeholder="date" /> | |
<input type="text" class="js-task" placeholder="task" /> | |
<input type="text" class="js-building" placeholder="building" /> | |
<input type="text" class="js-location" placeholder="location" /> | |
<input type="time" class="js-start" placeholder="start" /> | |
<input type="time" class="js-end" placeholder="end" /> | |
<button>Add time entry</button> | |
</form> | |
<table> |
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
export const snakeCase = str => str.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase() |
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
<?php | |
/** | |
* Creates a new WordPress user with auto-generated password | |
* @param string $username | |
* @param string $email | |
* @return array[id=>int,password=>string]|WP_Error id and password of created user | |
*/ | |
function createNewUser( $username, $email ) { | |
$length = 8; | |
$randomPassword = wp_generate_password($length); |
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
<?php | |
/** | |
* gets value from gravity form entry for field with given label | |
* TODO search admin label as well? | |
* @param string $label field label (case insensitive) | |
* @param Form $form gravity form object | |
* @param array $entry gravity form entry | |
* @return string|boolean submitted value | |
*/ | |
function getSubmissionValueByLabel($label, $form, $entry) { |
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
#! /usr/bin/env bash | |
echo -n '<h1>hello world</h1>' | lzma -9 | base64 | printf "https://itty.bitty.site/#%s/%s\n" "Title" "$(cat -) |
OlderNewer