Skip to content

Instantly share code, notes, and snippets.

honktang / gist:60e130040d2a9bddd6be5cfc7e88818e
Created August 16, 2017 02:39 — forked from jcsrb/gist:1081548
get avatar from google profiles, facebook, gravatar, twitter, tumblr
function get_avatar_from_service(service, userid, size) {
// this return the url that redirects to the according user image/avatar/profile picture
// implemented services: google profiles, facebook, gravatar, twitter, tumblr, default fallback
// for google use get_avatar_from_service('google', profile-name or user-id , size-in-px )
// for facebook use get_avatar_from_service('facebook', vanity url or user-id , size-in-px or size-as-word )
// for gravatar use get_avatar_from_service('gravatar', md5 hash email@adress, size-in-px )
// for twitter use get_avatar_from_service('twitter', username, size-in-px or size-as-word )
// for tumblr use get_avatar_from_service('tumblr', blog-url, size-in-px )
// everything else will go to the fallback
// google and gravatar scale the avatar to any site, others will guided to the next best version
honktang / web-snippet-055 ( upload to Imgur in JavaScript)
Created June 14, 2017 06:14 — forked from achudars/web-snippet-055 ( upload to Imgur in JavaScript)
Use JavaScript to upload anonymously to Imgur using Imgur API and show the link to the file. Make sure your API key is valid and working!
function upload(file) {
var imageLink ="";
/* Is the file an image? */
if (!file || !file.type.match(/image.*/)) return;
var fd = new FormData();
fd.append("image", file); // Append the file
fd.append("key", "<Imgur API key>");
honktang /
Created June 6, 2017 02:45 — forked from ronaldsmartin/
Google Spreadsheet JSON Queries

SheetAsJSON + Filtering

This is an extension of DJ Adams' excellent SheetAsJSON Google Apps Script, which provides a way to GET a published Google Spreadsheet as a JSON feed. This version allows generic filtering for terms, more specific control over which rows to parse, and correct MIME type for JSONP output.

Minimal Usage

The following parameters are required for the script to work.
+ id=<spreadsheet key>
+ sheet=<sheet name on spreadsheet>
honktang / url_to_drive.js
Created June 2, 2017 07:54 — forked from denilsonsa/url_to_drive.js
Google Apps Script to upload a file from an URL directly to Google Drive.
// Google Apps Script
// Allows uploading a URL directly to Google Drive.
// Live link:
// Source-code:
git --git-dir=/path/to/repo.git --work-tree=. init && echo "gitdir: /path/to/repo.git" > .git
// Based on ICanHaz (
// This version supports Mustache and Handlebars
// By M@ McCray
;var render = (function($, engine){
var cache = {},
methods = {};
$('script[type="text/html"]').each(function () {
var name = $(this).attr('id'),
honktang / restart_dropbox.bat
Last active February 1, 2017 17:42
Restart Dropbox
echo off
set app="%AppData%\Dropbox\bin\Dropbox.exe"
taskkill -F -IM "Dropbox.exe"
start "Restart Dropbox" %app% -B;
honktang / .bashrc(local)
Created September 21, 2012 04:35
git pull/push without password , msysgit on windows
#eval `ssh-agent`
honktang / vhost.js
Created September 10, 2012 07:06 — forked from billywhizz/vhost.js
Example of vhosts in node.js
var http = require("http");
add following to your hosts config to test: