Skip to content

Instantly share code, notes, and snippets.

degree score
0 0
1 1, 2
2 3-5
3 6-9
4 10-14
5 15-20
6 21-27
7 28-35
@javascript
Feature: Device Info
As a Tapjoy employee
I want to search devices
So that I can efficiently manage their clicks, apps and rewards
Scenario: Visiting the "device info" page without a search
When I visit the device info "show" page
Then I should see the "search bar"
And I should not see the "Apps Section"
@javascript
Feature: Device Info
As a Tapjoy employee
I want to search devices
So that I can efficiently manage their clicks, apps and rewards
Scenario: Visiting the "device info" page without a search
Given I have not submitted any searches on the "device info" page
When I visit the "device info" page
Then I should see the search bar
@akasper
akasper / store.rb
Created January 12, 2012 19:57
RSpec "double"
class Store
def foo
Storage.store "abc", "bbc"
end
# def bar
# storage = Storage.new
# storage.some_instance_method "cnn"
# end
@akasper
akasper / post_csv.rb
Created September 21, 2011 15:13
With many page IDs
require 'rubygems'
require 'httparty'
require 'json'
require 'csv'
PAGE_IDS = ['vitrue', 'buddymedia' ] # ... and so on
ACCESS_TOKEN = 'AAACEdEose0cBAMRhF8cj7Gzt1SpNxPwW28dHkXPDLjqRVo2gfxB3lpDDZCdBZAyYv4xn1mTLtJn7c5s6MTBjEIYC73QR7fU1wHxjGShgZDZD'
def url_for_posts(page_id, token=ACCESS_TOKEN)
"https://graph.facebook.com/#{page_id}/posts?limit=500&access_token=#{token}"
def size_upload
result = {:export => {use: []}}
return result unless self.uploads_enabled?
result[:resize] = result[:encode] = {
width: self.upload_width,
height: self.upload_height
} if self.upload_width? && self.upload_height?
result[:resize_thumb] = result[:encode_thumb] = {
@akasper
akasper / size_upload.rb
Created May 6, 2011 19:30
A method for sizing an upload. Response to https://gist.github.com/959582
SIZING_METHODS = {:enable_images? => :resize, :enable_videos? => :encode}
def size_upload
result = {:export => {use: []}}
return result unless self.uploads_enabled?
['', '_thumb'].each do |insert|
w = "upload#{insert}_width".to_sym
w? = "#{w}?".to_sym
@akasper
akasper / bad_sort.rb
Created April 9, 2011 18:24
Coda's Sort Code
def sort(&blk)
#TODO Make this not explode
raise Exception.new("Haw, Haw!")
end
@akasper
akasper / hosts
Created March 15, 2011 14:32
host file
127.0.0.1 localhost
127.0.0.1 kasper.pipe.vitrue.com
127.0.0.1 publisher.kasper.pipe.vitrue.com
127.0.0.1 publishertest.kasper.pipe.vitrue.com
127.0.0.1 emcee.kasper.pipe.vitrue.com
127.0.0.1 emceetest.kasper.pipe.vitrue.com
127.0.0.1 evaluator.kasper.pipe.vitrue.com
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
@akasper
akasper / graph_object.rb
Created December 22, 2010 20:11
I CAN HAZ LIKES COUNT
class Moderation::GraphObject
include Mongoid::Document
include Mongoid::Timestamps
before_save :flag_fb_comments_and_likes_counts_changes
after_save :update_fb_comments_and_likes_counts_on_dispatch!
include Moderation::Remover
include Moderation::Flagger
include Moderation::Stateful