Skip to content

Instantly share code, notes, and snippets.

View trent-boyd's full-sized avatar

Trent Boyd trent-boyd

View GitHub Profile
@mkjiau
mkjiau / axios-interceptors-refresh-token.js
Last active March 13, 2024 10:59
Axios interceptors for token refreshing and more than 2 async requests available
let isRefreshing = false;
let refreshSubscribers = [];
const instance = axios.create({
baseURL: Config.API_URL,
});
instance.interceptors.response.use(response => {
return response;
}, error => {
@SlexAxton
SlexAxton / .zshrc
Last active April 25, 2023 03:57
My gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@trent-boyd
trent-boyd / less-saturate-fix.md
Created December 9, 2012 21:15
LESS: Proper Syntax for CSS3 "Saturate" Filter

What You Think Would Work

You'd think that the way LESS works, you could just make your own .saturate() function to handle all of your various vendor-specific CSS rules, like so:

.saturate(@pct) {
	filter: saturate(@pct);
	-webkit-filter: saturate(@pct);
	-moz-filter: saturate(@pct);
@trent-boyd
trent-boyd / countries-select.html
Created November 20, 2012 16:55
HTML: Countries in Select Element
<!--
NOTE: United States is first in this list, but if you want
to be nice and alphabetical about it, it should go
right under "United Kingdom" on line 234. :)
-->
<select name="Country">
<option value="United States" selected>United States</option>
<option value="Afghanistan">Afghanistan</option>
<option value="Albania">Albania</option>
@trent-boyd
trent-boyd / states-select.html
Created November 20, 2012 16:38
HTML: US States in Select Element
<!-- Full State Name -->
<select name="State">
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
@furf
furf / _.deep.js
Created July 30, 2012 17:06
underscore.js mixin for plucking nested properties
_.mixin({
// Get/set the value of a nested property
deep: function (obj, key, value) {
var keys = key.replace(/\[(["']?)([^\1]+?)\1?\]/g, '.$2').replace(/^\./, '').split('.'),
root,
i = 0,
n = keys.length;
@ehuynh
ehuynh / gist:2572398
Created May 1, 2012 23:37
Start and Stop Jenkins on OSX
# start
sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist
# stop
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
@leeoniya
leeoniya / po_box_re.js
Created April 1, 2011 23:17
leon's p.o. box detection regex
// leon's p.o. box detection regex
// for better results, trim and compress whitespace first
var pobox_re = /^box[^a-z]|(p[-. ]?o.?[- ]?|post office )b(.|ox)/i,
arr = [
"po box",
"p.o.b.",
"p.o. box",
"po-box",
"p.o.-box",