View video2gif.sh
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
$ more /usr/local/bin/video2gif.sh | |
#!/bin/bash | |
# https://engineering.giphy.com/how-to-make-gifs-with-ffmpeg/ | |
echo "Video file: " | |
read video_file | |
echo "Video start position (HH:MM:SS): " | |
read start_seek |
View error_log_color.php
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 | |
// https://stackoverflow.com/a/13101631 | |
$colorFormats = array( | |
// styles | |
// italic and blink may not work depending of your terminal | |
'bold' => "\033[1m%s\033[0m", | |
'dark' => "\033[2m%s\033[0m", | |
'italic' => "\033[3m%s\033[0m", |
View picsum.php
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 | |
for ( $i = 0; $i<10; $i++) { | |
$width = rand(600, 1200); | |
$height = rand(600, 1200); | |
file_put_contents( uniqid(rand(), true) . '.jpg', file_get_contents( 'https://picsum.photos/'.$width.'/'.$height)); | |
sleep(2); | |
} |
View phpcs-git.sh
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
for i in $(git status -s | sed 's/^\s//' | cut -d " " -f2 | grep '.php'); do ./vendor/bin/phpcs "$i"; done |
View attributes_regex.js
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 regex = /[\w_-]+=(['"])((?!\1).)+\1/gu; | |
`<div data-slogan="Don't do it" data-warning='Use double quotes (")'>`.match( regex) |
View Find debug traces before git push
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
grep 'error_log\|console' $(git status -s | sed 's/^\s//' | cut -d " " -f2) |
View width.js
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 elem = document.getElementById('myid'); | |
var w = window.getComputedStyle(elem).width; |
View parent.js
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 parent = document.getElementById('myid').parentNode |
View document_ready.js
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
// Not valid for IE8 or older (I don't mind) | |
document.addEventListener("DOMContentLoaded", () => { | |
// Some code | |
}); |
View wrap.js
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
// https://codepen.io/luissacristan/pen/vxmKoP | |
document.querySelectorAll( 'div' ).forEach( elem => { | |
elem.outerHTML = '<div>' + elem.outerHTML + '</div>'; | |
}); |
NewerOlder