Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am dannyamey on github.
  • I am dannyamey (https://keybase.io/dannyamey) on keybase.
  • I have a public key ASCGEhRc_Guc5EepRAWBxO9xm3bMPiJ9J8mgpT83z0sK2Ao

To claim this, I am signing this object:

exports.genre = function(req, res, next) {
var genre_id = req.param('id'),
start = req.param('start', 0),
num = 12;
client.smembers('genre:'+genre_id+':movies', function(err, movie_ids){
var movies = [], end = start + num;
if (end > movie_ids.length) end = movie_ids.length;
movie_ids = movie_ids.slice(start, end);
<script>
var Movie = Backbone.Model.extend({
});
var MovieList = Backbone.Collection.extend({
model: Movie
});
var GridView = Backbone.View.extend({
exports.index = function(req, res, next) {
client.sort('movies', 'BY', 'movie:*:data->year', 'LIMIT', '0', '12', 'ALPHA', 'DESC', 'GET', '#', function(err, replies) {
var movies = [];
async.forEachSeries(replies, function(reply, done) {
client.hgetall('movie:'+reply+':data', function(err, movie) {
if (err) return done(err);
movies.push(movie);
done();
});
@dannyamey
dannyamey / gist:1986158
Created March 6, 2012 13:01
Facebook iPhone User Agent
Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_0_1 like Mac OS X; en_US) AppleWebKit (KHTML, like Gecko) Mobile [FBAN/FBForIPhone;FBAV/4.1;FBBV/4100.0;FBDV/iPhone4,1;FBMD/iPhone;FBSN/iPhone OS;FBSV/5.0.1;FBSS/2; FBCR/Three;FBID/phone;FBLC/en_US;FBSF/2.0]
@dannyamey
dannyamey / backbone_keyevents.html
Created January 11, 2012 17:39
Backbone.js key event example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Untitled</title>
<style>
#example {
background: #f00;
width: 300px;
height: 300px;
fourSq.ui.ToastNotifier.instance_ = null;
fourSq.ui.ToastNotifier.START_ZINDEX = 5E3;
fourSq.views = fourSq.views || {};
fourSq.views.PhotoViewer = function () {};
fourSq.views.PhotoViewer = function () {};
fourSq.views.PhotoViewer = function () {};
fourSq.views.PhotoViewer = function () {};
fourSq.views.PhotoViewer = function () {};
fourSq.views.PhotoViewer = function () {};
fourSq.views.PhotoViewer = function () {};
@dannyamey
dannyamey / magic8ball
Created September 8, 2011 15:51
The magic 8 ball knows all
#!/usr/bin/env bash
lines=(
'As I see it, yes.'
'Concentrate and ask again.'
'You may rely on it.'
'Signs point to yes.'
'My sources say no.'
'Ask again later.'
'It is decidedly so.'