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 'rubygems' | |
require 'dm-core' | |
DataMapper::Logger.new($stdout, :debug) | |
DataMapper.setup(:default, 'sqlite3::memory:') | |
class Sale | |
include DataMapper::Resource | |
property :id, Serial |
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 'rubygems' | |
require 'dm-core' | |
require 'dm-aggregates' | |
DataMapper::Logger.new($stdout, :debug) | |
DataMapper.setup(:default, 'sqlite3::memory:') | |
class Retailer | |
include DataMapper::Resource |
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
time psql feedstitch_development -qt -c 'SELECT entries.* FROM entries INNER JOIN group_entries ON entries.id = group_entries.entry_id WHERE (group_entries.group_id IN (SELECT id FROM groups WHERE user_id = 1)) ORDER BY entries.published_at DESC LIMIT 10000' &> /dev/null | |
time mysql feedstitch_development -e 'SELECT entries.* FROM entries INNER JOIN group_entries ON entries.id = group_entries.entry_id WHERE (group_entries.group_id IN (SELECT id FROM groups WHERE user_id = 1)) ORDER BY entries.published_at DESC LIMIT 10000' &> /dev/null |
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 'rubygems' | |
require 'curb' | |
c = Curl::Easy.new("http://bit.ly/g5Fml") | |
c.follow_location = true | |
c.max_redirects = 5 | |
location = nil | |
c.on_header do |d| |
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 ApplicationController < ActionController::Base | |
include Mongolytics::Tracker | |
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
;(function($) { | |
$.fn.gistify = function() { | |
return this.each(function() { | |
this.innerHTML = 'Loading Gist '+this.id; | |
$.getJSON("http://gist.github.com/"+ this.id +".json?callback=?", function (gist) { | |
$('#'+gist.repo).replaceWith(gist.div); | |
}); | |
}); | |
} | |
})(jQuery); |
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
track_all_stats # tracks all actions | |
track_view_stats # tracks index, show | |
track_change_stats # tracks create, update, destroy | |
track_stats_for :new, :edit, :show, :destroy # track any action mix, other actions |
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
Mongolytics.stats_for_path user_path(@user) # using the path helper (not url helper) | |
Mongolytics.stats_for_keys :users, :show # using the controller and action |
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
curl -O http://sysoev.ru/nginx/nginx-0.7.62.tar.gz | |
tar zxvf nginx-0.7.62.tar.gz | |
cd nginx-0.7.62 | |
sudo /usr/local/nginx/sbin/nginx -V | |
./configure --with-http_ssl_module --add-module=/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/ext/nginx | |
sudo make install clean | |
OLDPID=`cat /usr/local/nginx/logs/nginx.pid` | |
sudo kill -USR2 $OLDPID | |
sudo kill -WINCH $OLDPID | |
sudo kill -QUIT $OLDPID |
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
Garb::Session.login('username', 'password') | |
class Report | |
include Garb::Resource | |
metrics :pageviews | |
end | |
Garb::Account.all.each do |account| | |
profile = account.profiles.first |