This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Rabl::Renderer.json(obj, "bla/show", format: :json, view_path: "views") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #count jobs | |
| Resque::Failure.count | |
| # Requeue all jobs in the failed queue | |
| (Resque::Failure.count-1).downto(0).each { |i| Resque::Failure.requeue(i) } | |
| # or | |
| # Clear the failed queue | |
| Resque::Failure.clear |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curl -O http://ktwit.net/code/watch-0.2-macosx/watch | |
| chmod +x watch | |
| ./watch | |
| sudo mv watch /usr/local/bin/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var ActivityStreamView = Backbone.View.extend({ | |
| el: '#main_stream', // el attaches to existing element | |
| initialize: function(){ | |
| _.bindAll(this, 'render', 'appendItem'); // every function that uses 'this' as the current object should be in here | |
| this.collection = new ActivityList(); | |
| this.collection.bind('add', this.appendItem); // collection event binder | |
| this.maxSize = 20; | |
| }, | |
| render: function(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Activity = Backbone.Model.extend({ | |
| url : "/activities", | |
| // From activity-streams-mongoose/lib/activityMongoose.js | |
| defaults: { | |
| verb: 'post', | |
| object: null, //ActivityObject | |
| actor: null, //ActivityObject | |
| url: '', | |
| title: '', | |
| content: '', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var ActivityCreateView = Backbone.View.extend({ | |
| el: '#new_activity', | |
| initialize: function(){ | |
| _.bindAll(this, 'newAct', 'render', 'changeType', 'includeLocation', 'sendMessage'); | |
| this.trimForServer = App.helper.trimForServer; | |
| var streamName = this.$el.find('#streamName').val(); | |
| var verb = this.trimForServer(this.$el.find('#verb-show')); | |
| var objectType = this.trimForServer(this.$el.find('#object-show')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var LocationHash = { | |
| displayName: {type: String}, | |
| position: { | |
| latitude: Number, | |
| longitude: Number | |
| } | |
| }; | |
| var ActivityObjectHash = { | |
| id: {type: String}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var im = require('imagemagick'); | |
| var Guid = require('guid'); | |
| function reducePhoto(req, res, next){ | |
| var photoIngested = req.photosUploaded['original']; | |
| if (photoIngested) { | |
| var sizeName = sizes[req.nextSizeIndex].name; | |
| var destPath = photoIngested.metadata.path + '-' + sizeName ; | |
| var nameParts = photoIngested.metadata.filename.split('.'); | |
| var newName = nameParts[0] + '-' + sizeName + '.' + nameParts[1]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var getDistinct = function (req, res, next, term, init){ | |
| var key = 'used.' + term; | |
| req[key] = init ? init : []; | |
| var query = {streams: req.session.desiredStream}; | |
| asmsDB.Activity.distinct(term, query, function(err, docs) { | |
| if (!err && docs) { | |
| _.each(docs, function(result){ | |
| req[key].push(result); | |
| }); | |
| next(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var im = require('imagemagick'); | |
| var Guid = require('guid'); | |
| var siteConf = require('./lib/getConfig'); | |
| var lib = new require('./lib/asms-client.js')(app, cf).streamLib; | |
| function ingestPhoto(req, res, next){ | |
| if (req.files.image) { | |
| im.identify(req.files.image.path, function(err, features){ | |
| if (features && features.width) { | |
| var guid = Guid.create(); |
NewerOlder