Skip to content

Instantly share code, notes, and snippets.

View jgaiao's full-sized avatar

João Gaião jgaiao

View GitHub Profile
@jgaiao
jgaiao / resize.js
Last active October 1, 2020 14:14 — forked from vishalsrini/resize.js
A simple JavaScript to resize an image and create a blob out of it
var Resize = function(outputQuality) {
this.outputQuality = (outputQuality === 'undefined' ? 0.8 : outputQuality);
this.photo = function(file, maxWidth, maxHeight, outputType, callback) {
var _this = this;
var reader = new FileReader();
reader.onloadend = function(readerEvent) {
_this.resize(readerEvent.target.result, maxWidth, maxHeight, outputType, callback);
}
reader.readAsDataURL(file);
}
@jgaiao
jgaiao / youtube-vimeo-url-parser.js
Created October 16, 2018 13:12 — forked from yangshun/youtube-vimeo-url-parser.js
YouTube Vimeo URL Parser
function parseVideo (url) {
// - Supported YouTube URL formats:
// - http://www.youtube.com/watch?v=My2FRPA3Gf8
// - http://youtu.be/My2FRPA3Gf8
// - https://youtube.googleapis.com/v/My2FRPA3Gf8
// - Supported Vimeo URL formats:
// - http://vimeo.com/25451551
// - http://player.vimeo.com/video/25451551
// - Also supports relative URLs:
// - //player.vimeo.com/video/25451551
@jgaiao
jgaiao / internet_radio_stream_aliases.sh
Created August 16, 2017 10:54 — forked from pwenzel/internet_radio_stream_aliases.sh
Internet Radio Streams Via Command Line
# 1. Install mplayer command line (via Brew, Macports, or APT)
# 2. Add the following aliases to ~/.profile
# 3. Type `source ~/.profile`
# 3. Type `news` or `current` to listen in your terminal
alias news="mplayer -playlist http://minnesota.publicradio.org/tools/play/streams/news.pls" # MPR News
alias current="mplayer -playlist http://minnesota.publicradio.org/tools/play/streams/the_current.pls" # The Current
alias classical="mplayer -playlist http://minnesota.publicradio.org/tools/play/streams/classical.pls" # Classical MPR
alias localcurrent="mplayer -playlist http://minnesota.publicradio.org/tools/play/streams/local.pls" # Local Current
alias heartland="mplayer -playlist http://minnesota.publicradio.org/tools/play/streams/radio_heartland.pls" # MPR Radio Heartland
@jgaiao
jgaiao / install_git_ftp.sh
Last active August 29, 2015 14:27 — forked from eric1234/install_git_ftp.sh
Install git-ftp on Ubuntu with sftp support and git ftp fetch support
# Rebuild curl with sftp support
apt-get install -y build-essential debhelper libssh2-1-dev
apt-get source curl
apt-get build-dep -y curl
cd curl-*
DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage
cd ..
dpkg -i curl*.deb libcurl3-nss*.deb libcurl4-doc*.deb libcurl4-openssl*.deb libcurl3_*.deb
# Use "drench" version which support `git ftp fetch`