This file contains 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
# Comment on a blog post | |
{ "index" : { "_index" : "activities", "_type" : "comment", "_id" : "HBASE-ACTIVITY-ID" } } | |
{ "aggregation_id" : "HBASE-AGGREGATION-ID", | |
"activity_types" : ["comment", "type2", "etc..."], | |
"timestamp" : "2009-11-15T14:12:12", | |
"content" : { | |
"key" : "value" #(e.g json data describing the activity - an application can use this to display the activity) | |
}, | |
"user" : { | |
"user_id" : "red rover user id" |
This file contains 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
# FactoryGirl3ForYouAndMe | |
# The new syntax: http://robots.thoughtbot.com/post/19412394597/factory-girl-hits-3-0 | |
# | |
# Where to learn sed? | |
# http://www.grymoire.com/Unix/Sed.html#uh-6 | |
# http://www.markhneedham.com/blog/2011/01/11/sed-across-multiple-files/ | |
# | |
# What needs to change? | |
find . -type f -name "*.rb" -print0 | xargs -0 grep "Factory.create" | |
find . -type f -name "*.rb" -print0 | xargs -0 grep "Factory.build" |
This file contains 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
require 'digest' unless defined?(Digest) | |
# Just in case this isn't a rails app | |
class Hash | |
def to_query | |
require 'cgi' unless defined?(CGI) && defined?(CGI::escape) | |
map {|k,v| [k,v].map {|p| CGI::escape(p.to_s) }.join('=') }.join('&') | |
end | |
end |
This file contains 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
select DATE_FORMAT(u.created_at, '%Y-%m'), DATE_FORMAT(p.published_at, '%Y-%m'), count(*) FROM pfeed_items p, users u where u.id = p.originator_id and p.type IN ('Pfeeds::UserJoinedGroup', 'Pfeeds::UserLeftGroup', 'Pfeeds::UserInvitedUser', 'Pfeeds::UserSharedActivity', 'Pfeeds::UserMessagedGroup', 'Pfeeds::UserPostedItem', 'Pfeeds::UserAttachedTag', 'Pfeeds::UserCreatedBlogPost', 'Pfeeds::UserLikedItem', 'Pfeeds::UserFollowedItem') AND u.created_at > '2012-01-01' AND p.published_at > '2012-01-01' GROUP BY DATE_FORMAT(u.created_at, '%Y-%m'), DATE_FORMAT(p.published_at, '%Y-%m') |
This file contains 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
# TODO: Add the code |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Bootstrap, from Twitter</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.0.4/css/bootstrap-combined.min.css" rel="stylesheet"> | |
</head> | |
<body> |
This file contains 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
# Change files around and other magic... | |
ls -d *.hbs | sed -e 's/.*/mv & &/' |
This file contains 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
Just some text |
This file contains 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
class RailsDebug | |
class << self | |
def show_session(cookie) | |
Marshal.load(Base64.decode64(CGI.unescape(cookie.split("\n").join).split('--').first)) | |
end | |
end | |
end |
OlderNewer