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
.Grid { | |
--Grid-cell-width: 5em; /* Change this */ | |
--Grid-gutter: 0.5em; | |
display: flex; | |
flex-wrap: wrap; | |
margin: calc(var(--Grid-gutter) * 0.5); | |
} | |
.Grid > * { |
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
<?php | |
add_action( 'switch_theme', function () | |
{ | |
update_option('thumbnail_size_w', 500); | |
update_option('thumbnail_size_h', 500); | |
update_option('thumbnail_size_cropt', 0); | |
update_option('medium_size_w', 1000); | |
update_option('medium_size_h', 1000); |
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
# Usage: | |
# <movie_file> <start_time> <duration> <output_name> | |
# ./makegif.sh movie.mp4 00:00 10 output.gif | |
# | |
# Check if ffmpeg is installed | |
if ! which ffmpeg >/dev/null; then | |
printf "\n\033[0;31mYou need to install ffmpeg to use this! Visit: https://ffmpeg.org/download.html\033[0m\n\n" | |
exit 1 | |
fi |
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
var levDist = function(s, t) { | |
var d = []; //2d matrix | |
// Step 1 | |
var n = s.length; | |
var m = t.length; | |
if (n == 0) return m; | |
if (m == 0) return n; |
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
:root { | |
--font-bold: 600; | |
} | |
html { | |
height: 100%; | |
box-sizing: border-box; | |
} | |
*, |
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 function randomHex() { | |
return '#' + (Math.random() * 0xFFFFFF << 0).toString(16) | |
} |
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
const targetEl = document.querySelector('.js-target') | |
const hideMouse = false | |
const idleTime = 3000 | |
let idleMouseTimer | |
targetEl.addEventListener('mousemove', (e) => { | |
if (!hideMouse) { | |
targetEl.style.cursor = '' | |
clearTimeout(idleMouseTimer) |
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
/* | |
Demo: | |
http://codepen.io/vincentorback/pen/ZLLJbB | |
*/ | |
export function objectFit (el) { | |
let objectElReplacement = `<div | |
class="${el.classList}" | |
style=" | |
background-image:url(${el.getAttribute('src')}); |
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
<?php | |
/** | |
* Function creates post duplicate as a draft and redirects then to the edit post screen | |
*/ | |
function duplicate_post_as_draft() { | |
global $wpdb; | |
if (!(isset($_GET['post']) || isset($_POST['post']) || (isset($_REQUEST['action']) && 'duplicate_post_as_draft' == $_REQUEST['action']))) { | |
wp_die('No post to duplicate has been supplied!'); |
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
/** | |
* Get scroll position | |
* @param {Object} rootElement | |
* @return {Object} | |
*/ | |
export function getScrollPosition (rootElement) { | |
return { | |
y: rootElement ? rootElement.scrollTop : window.pageYOffset, | |
x: rootElement ? rootElement.scrollLeft : window.pageXOffset | |
} |