Skip to content

Instantly share code, notes, and snippets.

View vincentorback's full-sized avatar
🌻

Vincent Orback vincentorback

🌻
View GitHub Profile
:root {
--font-bold: 600;
}
html {
height: 100%;
box-sizing: border-box;
}
*,
@vincentorback
vincentorback / levenshtein.js
Last active April 6, 2017 10:50
Levenshtein Distance
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;
@vincentorback
vincentorback / makegif.sh
Last active May 12, 2017 10:23
Make high quality gif
# 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
@vincentorback
vincentorback / image-sizes.php
Created March 15, 2018 14:22
Update and force image sizes in WordPress
<?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);
.Grid {
--Grid-cell-width: 5em; /* Change this */
--Grid-gutter: 0.5em;
display: flex;
flex-wrap: wrap;
margin: calc(var(--Grid-gutter) * 0.5);
}
.Grid > * {

Keybase proof

I hereby claim:

  • I am vincentorback on github.
  • I am wincent95 (https://keybase.io/wincent95) on keybase.
  • I have a public key whose fingerprint is 5226 9E7E 2E44 8C51 A353 F1FF E3A0 C36B 4994 F81B

To claim this, I am signing this object:

@vincentorback
vincentorback / cart.less
Last active December 27, 2018 12:51
Hide empty Squarespace cart, until a product is added.
.Cart {
transition: 300ms;
}
.Cart[hidden] {
display: inline-block;
opacity: 0;
visibility: hidden;
}
@vincentorback
vincentorback / truncate.css
Last active March 31, 2020 20:31
Truncate text with PHP and CSS
/**
* Text truncation
*
* Prevent text from wrapping onto multiple lines, and truncate with an
* ellipsis.
*
* 1. Ensure that the node has a maximum width after which truncation can
* occur.
* 2. Fix for IE 8/9 if `word-wrap: break-word` is in effect on ancestor
* nodes.
@vincentorback
vincentorback / visibilitychange.js
Created March 15, 2020 18:54
Handle visibilitychange better
function handleHidden (callbackHidden, callbackVisible) {
var browserPrefixes = ['moz', 'ms', 'o', 'webkit']
var isVisible = true // internal flag, defaults to true
// get the correct attribute name
function getHiddenPropertyName (prefix) {
return (prefix ? prefix + 'Hidden' : 'hidden')
}
// get the correct event name
/**
* detect IE
* returns version of IE or false, if browser is not Internet Explorer
*/
function detectIE() {
var ua = window.navigator.userAgent;
// Test values; Uncomment to check result …
// IE 10