Skip to content

Instantly share code, notes, and snippets.

View jrolfs's full-sized avatar

Jamie Rolfs jrolfs

View GitHub Profile
# Check if we're being scraped by FB, if so return Open Graph object
# metadata, otherwise load respective content or redirect based on
# the user agent string
if !request.env['HTTP_USER_AGENT'].match(/facebookexternalhit/i).nil?
# Get some data in order for template
@canonical_url = "#{ request.protocol + request.host }/v0/facebook/videos/#{ @video.short_id }"
columns: [{
label: 'Tags',
css: 'tags'
}, {
label: 'YouTube Views',
css: 'yt-views'
}, {
label: 'YouTube Likes',
css: 'yt-likes'
}, {
var m = function () {
if (this.reply_to) {
emit(this.reply_to, { count: 1 });
}
}
var r = function (key, values) {
var count = 0;
for (var i in values) {
PRIMARY> db.youtubecomments.mapReduce(m, r, 'replies').find()
{ "_id" : "-2gg__hAxbg-kQBhJanSvXkGZo8EZFH1aS-RqQy2RPE", "value" : { "count" : 1 } }
{ "_id" : "-2gg__hAxbgXM2XcGBwZR2B6jqvG5y9_spuuHoi2o30", "value" : { "count" : 2 } }
{ "_id" : "-2gg__hAxbggKIMO8tl6-hc3GlFB_UZYhFRSFWl41bw", "value" : { "count" : 2 } }
{ "_id" : "-2gg__hAxbgpuFj5hCBcf4iEXPHQqV6N6PBtBUlmLvA", "value" : { "count" : 1 } }
{ "_id" : "-2gg__hAxbgsXUjmPz_vZlsXbypQu537lB9OibzaEHo", "value" : { "count" : 1 } }
{ "_id" : "-2gg__hAxbhPt6JfsXU3yX7uo_6US1PITJw3Hv4vGhY", "value" : { "count" : 1 } }
{ "_id" : "-2gg__hAxbisTNkLx1I-7zfw-VyAxcfJUwDrV5fE3kA", "value" : { "count" : 1 } }
{ "_id" : "-2gg__hAxbitkyDAO5jeSx9OQ6-4_32oIMTve22vUD8", "value" : { "count" : 2 } }
{ "_id" : "-2gg__hAxbjB7DE--eN4-OlCvyCOftyektcELv21Gog", "value" : { "count" : 1 } }
var CHANNEL_ID = ObjectId('4f78ffa81a6fd67f3c00002b');
var AFTER_DATE = new Date(2013, 1, 1);
var query = {
youtubechannel_id: CHANNEL_ID,
created_at: { $gte: AFTER_DATE }
};
PRIMARY> db.replies.find(null, {'value.count': 1, 'value.author': 1})
{ "_id" : null, "value" : { "count" : 0, "author" : "youtube user 0" } }
{ "_id" : "-2gg__hAxbg-kQBhJanSvXkGZo8EZFH1aS-RqQy2RPE", "value" : { "count" : 1 } }
{ "_id" : "-2gg__hAxbgMyb4n-eeOCMGgbPNWqE7rpuCGrIfn_2c", "value" : { "count" : 0, "author" : "chrisdobson" } }
{ "_id" : "-2gg__hAxbgNr4an4pEmy2K_zukbgRHnjttqrqX5OvU", "value" : { "count" : 0, "author" : "minotetatui" } }
{ "_id" : "-2gg__hAxbgTwriRWoDhE2B3Ls52Va-0OXYWfIq4EFY", "value" : { "count" : 0, "author" : "theminimalisto" } }
{ "_id" : "-2gg__hAxbgVPm0QTOQRTv1WbOi7UdmBy_Tg1QM5UiA", "value" : { "count" : 0, "author" : "mrexcite007" } }
{ "_id" : "-2gg__hAxbgXM2XcGBwZR2B6jqvG5y9_spuuHoi2o30", "value" : { "count" : 2 } }
{ "_id" : "-2gg__hAxbgbVDqW0ZOiAcWueIfB98I9XD_cT7PlvCI", "value" : { "count" : 0, "author" : "animetothebeginning" } }
{ "_id" : "-2gg__hAxbggKIMO8tl6-hc3GlFB_UZYhFRSFWl41bw", "value" : { "count" : 2 } }
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Action Controller: Exception caught</title>
<style>
body { background-color: #fff; color: #333; }
body, p, ol, ul, td {
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
@jrolfs
jrolfs / dialog.js
Last active December 13, 2015 17:28
onRemoveClick: function (event) {
killEvent(event);
// Grab a reference to the original button so we
// can put a spinner in it later
var $button = $(event.currentTarget);
dispatcher.trigger('command:ShowAlert', {
icon: 'warning-sign', // <i class="icon-warning-sign"></i>
message: 'Are you sure you want to delete <strong>' +
{
"sublimelinter_gutter_marks": false,
"sublimelinter_popup_errors_on_save": true,
"sublimelinter_fill_outlines": true,
// An array of linter names to disable. Names should be lowercase.
"sublimelinter_disable":
[
"csslint"
],
metrics: [{
label: 'YouTube Views',
metric: 'views',
options: { colors: ['#4f9cd5'] }
}, {
label: 'YouTube Likes',
metric: ['likes', 'dislikes'],
options: [{
colors: ['#73c124']
}, {