Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Huang Shuo-Han ArvinH

🏠
Working from home
View GitHub Profile
@ArvinH
ArvinH / geonames_cities_100k.geojson
Created Sep 8, 2019
geojson file geonames_cities_100k
View geonames_cities_100k.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ArvinH
ArvinH / curl.js
Created Jan 20, 2019 — forked from schamane/curl.js
Curl vs http module for nodejs
View curl.js
var exec = require('child_process').exec,
url = "http://google.com/",
timeout = "3",
data="?q=test";
var time = process.hrtime();
exec('curl --max-time ' + timeout + ' -d \'' + data + '\' ' + url, function (error, stdout, stderr) {
var diff = process.hrtime(time);
//console.log('stdout: ' + stdout);
//console.log('stderr: ' + stderr);
@ArvinH
ArvinH / fetchCalendarData.js
Created Dec 15, 2018
2018-12-15 fetch calendar data through google api v3
View fetchCalendarData.js
const fs = require('fs');
const readline = require('readline');
const { google } = require('googleapis');
// If modifying these scopes, delete token.json.
const SCOPES = ['https://www.googleapis.com/auth/calendar.readonly'];
// The file token.json stores the user's access and refresh tokens, and is
// created automatically when the authorization flow completes for the first
// time.
const TOKEN_PATH = 'token.json';
@ArvinH
ArvinH / vimeo-python-serversample.py
Created Apr 14, 2018
Sample code for handling vimeo api in python server
View vimeo-python-serversample.py
from flask import Flask, Blueprint, request, current_app, jsonify
import requests
import json
video_blueprint = Blueprint(
'video',
__name__
)
View deeplearnjs-chromeextension-content.js
chrome.runtime.onMessage.addListener(gotMessage)
function gotMessage(message, sender, sendResponse){
let direction = 0;
if(message.direction == 'up'){
direction = -500;
} else if(message.direction == 'down'){
direction = +500;
} else if (message.direction == 'turn off') {
const mask = document.getElementById('body-maskDiv');
if (mask) {
View deeplearnjs-chromeextension-popup.js
console.log('popup ready!');
let startPredicting = false;
let times = 0;
let y = 0;
document.addEventListener('DOMContentLoaded', function() {
let video = document.getElementById('video');
let still = document.getElementById('still');
@ArvinH
ArvinH / googleCalendar_nodejs_parser.js
Last active Dec 12, 2017
googleCalendar nodejs parser
View googleCalendar_nodejs_parser.js
var fs = require('fs');
var readline = require('readline');
var google = require('googleapis');
var googleAuth = require('google-auth-library');
// If modifying these scopes, delete your previously saved credentials
// at ~/.credentials/calendar-nodejs-quickstart.json
var SCOPES = ['https://www.googleapis.com/auth/calendar.readonly'];
var TOKEN_DIR = (process.env.HOME || process.env.HOMEPATH ||
process.env.USERPROFILE) + '/.credentials/';
@ArvinH
ArvinH / README.md
Last active Dec 12, 2017
Google_Calendar_D3
View README.md
@ArvinH
ArvinH / ResizeObserver.js
Created Nov 23, 2017
ResizeObserver Polyfill - src: cdpn.io/WoJoNB
View ResizeObserver.js
class ResizeObserver {
constructor() {
this.observables = [];
// Array of observed elements that looks like this:
// [{
// el: domNode,
// callback: func,
// size: {height: x, width: y}
// }]
this.boundCheck = this.check.bind(this);