Skip to content

Instantly share code, notes, and snippets.

View davidefavia's full-sized avatar
🚲
Biking

Davide Favia davidefavia

🚲
Biking
View GitHub Profile
@davidefavia
davidefavia / yt-list-to-mp3
Created June 19, 2016 15:47
Convert YouTube playlist to mp3
#!/bin/bash
clear;
echo "Insert YouTube playlist ID: ";
read playlistId;
# You need youtube-dl to use this script: http://youtube-dl.org/
youtube-dl --extract-audio --audio-format mp3 --yes-playlist https://www.youtube.com/watch?list=$playlistId -i
@davidefavia
davidefavia / index.js
Created March 29, 2016 16:55
isArray
// https://developer.mozilla.org/it/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray#Polyfill
if (!Array.isArray) {
Array.isArray = function(arg) {
return Object.prototype.toString.call(arg) === '[object Array]';
};
}
@davidefavia
davidefavia / .htaccess
Last active August 29, 2015 14:21
AngularJS snapshots
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{HTTP_USER_AGENT} googlebot|yahoo|bingbot|baiduspider [NC]
RewriteCond %{QUERY_STRING} ^_escaped_fragment_=$
RewriteRule ^(.*)$ /snapshots/index.html [R=302,NC,L]
RewriteCond %{HTTP_USER_AGENT} googlebot|yahoo|bingbot|baiduspider [NC]
RewriteCond %{QUERY_STRING} ^_escaped_fragment_=/?(.*)$
RewriteRule ^(.*)$ /snapshots/%1? [R=302,NC,L]