Skip to content

Instantly share code, notes, and snippets.

#include <iostream>
using namespace std;
int main() {
const int NUM_ELEMENTS = 8; // Number of elements
int userVals[NUM_ELEMENTS]; // User numbers
int i = 0; // Loop index
int sumVal = 0; // For computing sum
// Prompt user to populate array
def all_delayed_timestamps
guess = 100
current = []
until (current = Resque.delayed_queue_peek(0, guess)).size < guess
guess = guess * guess
end
current
end
def all_delayed_jobs
require "capybara"
# Encapsulate some jQuery UI interactions so we can call them cleanly using Capybara.
module Capybara::JQueryUI
# Find the jQuery UI Autocomplete widget corresponding to this element
def autocompleter
jquery_result(jquery_this(".autocomplete('widget')").first)
end
# Fill in an autocompletable field and accept a completion.
@ess
ess / user_steps.rb
Last active December 30, 2015 09:39
Given %{I am a signed in user} do
email = memorize_fact(
:user_email,
Faker::Internet.email
)
password = memorize_fact(
:user_password,
%{they'retrashingourrightstrashingtrashing}
)
@ess
ess / gist:5486484
Created April 30, 2013 03:46
Challenge to my nerd friends...come up with lyrics for a song called "End of the Internets" in the style of "End of the Innocence" by Don Henley.
Remember when the tubes were strong
And ping times weren't all that high
Wasn't any lag in the world
When downstream and upstream seemed to fly
@story_46295397
Feature: Publishing a journey
As a creator or editor
I want to publish a journey
So that others can subscribe to my content
Scenario: Publishing a draft # features/publish_journey.feature:8
Given I've created a publishable journey # features/step_definitions/publishing_steps.rb:1
When I click the publish button # features/step_definitions/publishing_steps.rb:22
Then I should be on the publish journey page # features/step_definitions/publishing_steps.rb:43
@ess
ess / gist:5199669
Last active December 15, 2015 04:09
@story_46295397
Feature: Publishing a journey
As a creator or editor
I want to publish a journey
So that others can subscribe to my content
Scenario: Fail on missing keyword # features/publish_journey.feature:16
Given I've created a publishable journey # features/step_definitions/publishing_steps.rb:1
And I'm on the publish journey page # features/step_definitions/publishing_steps.rb:78
current url == 'http://www.example.com/communities/community-1/journeys/journey-1/confirm_publish'

Using bitlbee with HipChat

Initial setup

  • account add jabber [email protected] 'PASSWORD'
  • account hipchat set nick_source full_name
  • account hipchat set resource bot
  • account hipchat on
BounceAround::Application.routes.draw do
constraints(host: BA_HOSTNAME) do
devise_for :users
resources :domains do
resources :riccochets
end
match '/dashboard' => 'root#dashboard', via: :get, as: 'dashboard'
root to: 'root#index'
end
def self.filter(filters)
filters.inject(self) {|accum, obj| accum.apply_filter(obj[0], obj[1])}
end
def self.collection_for(collection_scope, options={})
checked_divisions = options[:divisions] || Division.all.map(&:id)
filters = options[:filters] || {}
self.filter(filters).send(collection_scope).for_divisions(checked_divisions)
end