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
report = Garb::Report.new(profile, :metrics => [:visits], :dimensions => [:hostname]) | |
report.filters {:hostname.does_not_match => 'record.net.au'} | |
report.results |
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 'dm-core' | |
class IntegerCsv < DataMapper::Property::Text | |
def primitive?(value) | |
super || value.kind_of?(::Array) | |
end | |
def load(value) | |
case value |
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
# encoding: utf-8 | |
require 'carrierwave/processing/mini_magick' | |
class EmployeePhotoUploader < CarrierWave::Uploader::Base | |
include CarrierWave::MiniMagick | |
# Choose what kind of storage to use for this uploader: | |
storage :file |
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> | |
<head> | |
<title>Examples Index</title> | |
</head> | |
<body data-controller="examples" data-action="index"> | |
<div id="content"> | |
<h1>Page 1</h1> | |
<a href="page2.js" data-remote="true">Page 2</a> | |
</div> |
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
module Sunspot | |
module DataMapper | |
def self.included(base) | |
base.class_eval do | |
alias new_record? new? | |
end | |
base.extend Sunspot::Rails::Searchable::ActsAsMethods | |
Sunspot::Adapters::DataAccessor.register(DataAccessor, base) |
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
# ----------------- OAUTH CONSUMER ------------------ | |
consumer = OAuth::Consumer.new('anonymous', 'anonymous', { | |
:site => 'https://www.google.com', | |
:request_token_path => '/accounts/OAuthGetRequestToken', | |
:access_token_path => '/accounts/OAuthGetAccessToken', | |
:authorize_path => '/accounts/OAuthAuthorizeToken' | |
}) | |
# ----------------- NEW OAUTH TOKEN ------------------ | |
request_token = consumer.get_request_token({}, {:scope => 'https://www.google.com/analytics/feeds'}) |
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
#!/usr/bin/env ruby | |
$: << 'test' << 'lib' | |
Dir.glob(ARGV).each {|f| load f unless f =~ /^-/} | |
# Usage: ruby_test test/unit/**/*.rb |
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
21:47:15 web.1 | SQL (51.210ms) SELECT "id", "counts", "successful", "created_at", "completed_at", "retailer_id" FROM "log_extracts" WHERE "retailer_id" IN (20, 13, 12, 21, 19, 17, 3, 6, 16, 22, 4, 10, 7, 8, 9, 14, 11, 1, 2, 5, 18, 15) ORDER BY "id" | |
21:47:15 web.1 | SQL (1.790ms) SELECT "id", "counts", "successful", "created_at", "completed_at", "retailer_id" FROM "log_extracts" WHERE "retailer_id" = 20 ORDER BY "created_at" DESC LIMIT 1 | |
21:47:15 web.1 | SQL (2.306ms) SELECT "id", "counts", "successful", "created_at", "completed_at", "retailer_id" FROM "log_extracts" WHERE "retailer_id" = 13 ORDER BY "created_at" DESC LIMIT 1 | |
21:47:15 web.1 | SQL (1.429ms) SELECT "id", "counts", "successful", "created_at", "completed_at", "retailer_id" FROM "log_extracts" WHERE "retailer_id" = 12 ORDER BY "created_at" DESC LIMIT 1 | |
21:47:15 web.1 | SQL (0.889ms) SELECT "id", "counts", "successful", "created_at", "completed_at", "retailer_id" FROM "log_extracts" WHERE "retailer_id" = 21 O |
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 'bundler/setup' | |
require 'reel' | |
require 'celluloid/io' | |
require 'pg' | |
module PGNotifications | |
def self.included(actor) | |
actor.send(:include, Celluloid::IO) | |
end |