Skip to content

Instantly share code, notes, and snippets.

@obelmont
obelmont / maxwords.js
Created December 5, 2019 10:08
maxWords
function maxWords(words, chars = 25, append){
return `${words.split(' ').slice(0, chars).join(' ')}${append || ''}`
}
@obelmont
obelmont / wrap.js
Created December 3, 2019 04:07
Wrap div in another div, equivalent of jQuery wrap in vanilla js
function wrap(element, wrapper, classes = []) {
element.parentNode.insertBefore(wrapper, element);
wrapper.classList.add(...classes);
wrapper.appendChild(element);
}
// example usage
wrap(document.querySelector('#wrap'), document.createElement('div'), ['class1', 'class2']);
References
// Yes
https://www.stinkstudios.com (animations / image placeholders / page transitions)
https://martinwecke.de (navigation)
http://www.monomono.studio/ (interactivity)
https://jenniferheintz.com/ (interactvity not the scrolljacking)
http://tennentbrown.co.nz/projects/spirit/aro-ha-retreat (Typework)
https://jonny.wtf/ (physics - probably matter.js)
@obelmont
obelmont / keybase.md
Created September 12, 2019 22:52
keybase.md

Keybase proof

I hereby claim:

  • I am obelmont on github.
  • I am obelmont (https://keybase.io/obelmont) on keybase.
  • I have a public key ASBS-AzJdrZV-8wAMhbIPJCsT-Tko2vxQHtDO3qVQWO8kgo

To claim this, I am signing this object:

@obelmont
obelmont / election.md
Last active May 18, 2019 01:32
Election

NSW

  • Wentworth (lost at Turnbull's by election, imo will stay Ind)
  • Warringah (Tony Abbott doing everything he can to lose this election)
  • Gilmore (Current Lib member retiring, held on less than 1% margin could go Lab)
  • Banks (Previously Labor seat, will probably swing back who knows NSW is more fucked than QLD sometimes)
  • Eden-Monaro (BeLlWeAtHeR SeAt)

Vic

@obelmont
obelmont / acf_ratio.php
Last active February 13, 2018 00:13
ACF Image Ratio
//Add image ratios to the image array returned through ACF
function imageRatio( $value, $post_id, $field){
//Only alter array
if ($field['return_format'] === 'array') {
$id = $value['id'];
if( $sizes = get_intermediate_image_sizes() ) {