Skip to content

Instantly share code, notes, and snippets.

Avatar

Artem Yankov yankov

View GitHub Profile
@yankov
yankov / gist:1123843
Created Aug 3, 2011
Faye node.js server
View gist:1123843
//download the lib from http://faye.jcoglan.com/download.html
var http = require('http'),
faye = require('./faye/faye-node.js');
var bayeux = new faye.NodeAdapter({
mount: '/faye',
timeout: 45
});
@yankov
yankov / gist:1123852
Created Aug 3, 2011
Sending message to faye server from ruby
View gist:1123852
def notify(message)
msg = JSON.dump('channel' => "/notifications/channel", 'data' => {'text' => message})
uri = URI.parse('http://127.0.0.1:3333/faye')
Net::HTTP.post_form(uri, :message => msg)
end
View gist:1123860
//have to include http://127.0.0.1:3333/faye.js in the html file
var client = new Faye.Client('http://127.0.0.1:3333/faye', { timeout: 120 });
var subscription = client.subscribe('/notifications/channel', function(message) {
alert(message.text);
});
//or with user_id as a channel
View gist:1147979
# On a back-end side
Comet.trigger("some_event", user, {:text => 'hello'})
#on a front-end side
Badgeville.bind('some_event', function(data) {
console.log("Event handler here");
});
View gist:1166304
Badgeville.ready(function(){
Badgeville.Comet.bind( function( event, message ) {
console.log('site notification');
console.log( message );
event_handler(message);
});
Badgeville.bind( 'siteMessage', function( event, message ) {
console.log( message );
View gist:1166306
Badgeville.ready(function(){
Badgeville.Comet.bind( function( event, message ) {
console.log('site notification');
console.log( message );
event_handler(message);
});
Badgeville.bind( 'siteMessage', function( event, message ) {
console.log( message );
View gist:1283029
{
'contents': [
{'content_id' : 1, 'content_url' : 'url'},
{'content_id' : 2, 'content_url' : 'url2'},
],
'result' : [existing_array] //something that we return right now
}
View gist:1285157
[
-{
-data: {
-result: {
points: 1
}
+activity: { … }
rewards: [ ]
+user: { … }
}
View gist:1285192
[
-{
-data:
{
+result: { }
+activity: { }
rewards: [ ]
+user: { }
}
}
View gist:1297612
11/10/18 23:28:46 INFO mapred.JobClient: map 0% reduce 0%
11/10/18 23:29:10 INFO mapred.JobClient: Task Id : attempt_201110180937_0045_m_000000_0, Status : FAILED
Error: java.lang.InstantiationError: org.bson.BSONDecoder
at com.mongodb.hadoop.io.BSONWritable.readFields(BSONWritable.java:167)
at org.apache.hadoop.io.WritableComparator.compare(WritableComparator.java:97)
at com.mongodb.hadoop.io.BSONComparator.compare(BSONComparator.java:41)
at org.apache.hadoop.mapred.MapTask$MapOutputBuffer.compare(MapTask.java:1110)
at org.apache.hadoop.util.QuickSort.fix(QuickSort.java:30)
at org.apache.hadoop.util.QuickSort.sortInternal(QuickSort.java:83)
at org.apache.hadoop.util.QuickSort.sort(QuickSort.java:59)