Head over to developer.facebook.com and create an App
On your server, create a facebook webhook that will handle facebook calls. Then create a "leadgen" webhook on you App: https://developers.facebook.com/docs/graph-api/webhooks/v2.5
//Here is the curl commands I use to test - make sure you update the CAPSVARS. You can add an item ID Payload or not. | |
//For example if your app displays items, it can navigate to a specific item. | |
//If you want to add more state names, instead of only going to specific items: | |
//add another payload property called 'stateName' | |
//create a goState() function to accept a stateName as a parameter | |
//and modify the registerPush() to find the stateName property and pass into your goState(). | |
//Android | |
curl -u YOURAPIKEY: -H "Content-Type: application/json" -H "X-Ionic-Application-Id: APPID" https://push.ionic.io/api/v1/push -d '{"tokens":["ANDROIDTOKEN"],"notification":{"alert":"I come from planet Ion.", "android":{"title":"This is a title2", "payload":{"sound":"notification.mp3","itemId":"7TF00hJI78Y"}}}}' |
Head over to developer.facebook.com and create an App
On your server, create a facebook webhook that will handle facebook calls. Then create a "leadgen" webhook on you App: https://developers.facebook.com/docs/graph-api/webhooks/v2.5
// from http://scratch99.com/web-development/javascript/convert-bytes-to-mb-kb/ | |
function bytesToSize(bytes) { | |
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; | |
if (bytes == 0) return 'n/a'; | |
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); | |
if (i == 0) return bytes + ' ' + sizes[i]; | |
return (bytes / Math.pow(1024, i)).toFixed(1) + ' ' + sizes[i]; | |
}; |
function shortenNumber(n, d) { | |
if (n < 1) return "<1"; | |
var k = n = Math.floor(n); | |
if (n < 1000) return (n.toString().split("."))[0]; | |
if (d !== 0) d = d || 1; | |
function shorten(a, b, c) { | |
var d = a.toString().split("."); | |
if (!d[1] || b === 0) { | |
return d[0] + c |
var AWS = require('aws-sdk'); | |
AWS.config.update({ | |
accessKeyId: '{AWS_KEY}', | |
secretAccessKey: '{AWS_SECRET}', | |
region: '{SNS_REGION}' | |
}); | |
var sns = new AWS.SNS(); |
# Instantiate a new client | |
import stream | |
client = stream.connect('key', 'secret') | |
# Assume the notification is aggregated on | |
# {% if verb.infinitive == 'like' %}{{ object }}{% else %}{{ id }}{% endif %} | |
notification_feed = client.feed('notification', '1') | |
# Add two likes, one comment and two follows | |
activities = [ |
// this will remove all error logging globally | |
angular.config(function($provide) { | |
$provide.decorator("$firebaseObject", function($delegate) { | |
$delegate.prototype.$$error = function(err) { | |
this.$destroy(err); | |
}; | |
return $delegate; | |
}); | |
$provide.decorator("$firebaseArray", function($delegate) { |
var obj = {b: 3, c: 2, a: 1}; | |
_.sortKeysBy(obj); | |
// {a: 1, b: 3, c: 2} | |
_.sortKeysBy(obj, function (value, key) { | |
return value; | |
}); | |
// {a: 1, c: 2, b: 3} |
var path = require('path'); | |
var webpack = require('webpack'); | |
var ModuleReplace = webpack.NormalModuleReplacementPlugin; | |
module.exports = { | |
entry: { | |
'zjs/js/zyb_transfer_launch': 'zjs/js/zyb_transfer_launch.js', | |
}, | |
output: { |
A lot of us are interested in doing more analysis with our service logs so I thought I'd share an experiment I'm doing with Sync. The main idea is to transform the raw logs into something that'll be nice to query and generate reports with in Redshift.
Logs make their way into an S3 bucket (lets call it the 'raw' bucket) where we've got a lambda listening for new data. This lambda reads the raw heka protobuf gzipped data, does some transformation and writes a new file to a different S3 bucket (the 'processed' bucket) in a format that is redshift friendly (like json or csv). There's another lambda listening on the processed bucket that loads this data into Redshift.