Skip to content

Instantly share code, notes, and snippets.

View ArvinH's full-sized avatar
🏠
Working from home

Huang Shuo-Han ArvinH

🏠
Working from home
View GitHub Profile
// fork from https://gist.github.com/takien/4077195
function YouTubeGetID(url){
var ID = '';
url = url.replace(/(>|<)/gi,'').split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/);
if(url[2] !== undefined) {
ID = url[2].split(/[^0-9a-z_\-]/i);
ID = ID[0];
}
else {
ID = url.toString();
@ArvinH
ArvinH / MessengerGenericMessageAPI.js
Last active January 21, 2017 10:47
Messenger GenericMessage API usage
exports.sendNewsMessagePromise = (id, res) => {
const resData = res.extractorData.data[0].group;
const newResults = resData.map(function(item) {
return {
title: item.titleText[0].text,
buttons: [{
type: "web_url",
url: item.titleLink[0].href,
title: '看詳情',
}]
var GEO_LOCATION = {
watchID: null,
callback: null
};
GEO_LOCATION.mySpot = function(position){
var lat = (position.coords) ? new String(position.coords.latitude) : position.x;
var lon = (position.coords) ? new String(position.coords.longitude) : position.y;
return GEO_LOCATION.callback(lat, lon);
}
package org.sample.pubsub
import com.redis._
import akka.actor.ActorSystem
import akka.actor.Actor._
import akka.actor.Props
object Sub {
val actorSystem = ActorSystem("PubSubActorSystem")
println("starting subscription service...")