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
| #! /bin/sh | |
| ### BEGIN INIT INFO | |
| # Provides: mongodb | |
| # Required-Start: $all | |
| # Required-Stop: $all | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: starts the mongodb data-store | |
| # Description: starts mongodb using start-stop-daemon |
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
| 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 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
| class ApplicationController < ActionController::Base | |
| include Mongolytics::Tracker | |
| end |
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
| 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 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
| 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 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
| ;(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 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://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 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
| Garb::Session.login('username', 'password') | |
| class Report | |
| include Garb::Resource | |
| metrics :pageviews | |
| end | |
| Garb::Account.all.each do |account| | |
| profile = account.profiles.first |
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
| class Statistic | |
| include MongoMapper::Document | |
| key :format, String, :index => true, :required => true | |
| key :ip, String, :index => true, :required => true | |
| key :path, String, :index => true, :required => true | |
| end |
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
| module Rack | |
| class RequestStatisticTracker | |
| def initialize(app) | |
| @app = app | |
| end | |
| def call(env) | |
| status, headers, response = @app.call(env) | |
| path = env['REQUEST_PATH'] || env['PATH_INFO'] |