Skip to content

Instantly share code, notes, and snippets.

View ragaskar's full-sized avatar

Rajan Agaskar ragaskar

View GitHub Profile
######################
# A tool for facilitating retros (esp. ones with remote attendees)
# Usage:
# 1. new up a rando object in an irb session
# 2. Add everyone who arrives at the retro by passing strings to the .add method (can take one or many names)
# 3. Ask everyone to write topics on notecards (one topic per card). This can be themed ('one thing to change & why'), or not ('happy', 'meh', 'sad')
# 4. call .next, ask that person to read their card aloud. Use a timer + do a Roman vote to continue on the topic every 5 min.
######################
class Rando
@ragaskar
ragaskar / gist:3ec13eea2bdce1f07ad3
Created May 21, 2014 19:04
Getting Rails HTML from Controllers (without instantiation) programmatically in a rake task
session = ActionDispatch::Integration::Session.new(Rails.application)
session.get('/some/url/your/app/has')
body = session.response.body
@ragaskar
ragaskar / aggregates_current_organization.rb
Last active August 29, 2015 13:57
CloudController Repository Pattern
module Aggregate
class CurrentOrganization
attr_reader :organization, :spaces, :account
def initialize(attrs)
@organization = attrs.fetch(:organization)
@spaces = attrs.fetch(:spaces)
@account = attrs.fetch(:account)
end
/**
Starting with version 2.0, this file "boots" Jasmine, performing all of the necessary initialization before executing the loaded environment and all of a project's specs. This file should be loaded after `jasmine.js`, but before any project source files or spec files are loaded. Thus this file can also be used to customize Jasmine for a project.
If a project is using Jasmine via the standalone distribution, this file can be customized directly. If a project is using Jasmine via the [Ruby gem][jasmine-gem], this file can be copied into the support directory via `jasmine copy_boot_js`. Other environments (e.g., Python) will have different mechanisms.
The location of `boot.js` can be specified and/or overridden in `jasmine.yml`.
[jasmine-gem]: http://github.com/pivotal/jasmine-gem
*/
@ragaskar
ragaskar / no_parse_limit.rb
Last active December 20, 2015 07:29
demonstrates that nokogiri has no problem if the content is not large.
require 'nokogiri'
string = <<-STRING
<rss version="2.0">
<channel>
<title>thing</title>
<link>http://thing</link>
<description>blah</description> <language>en-us</language>
<ttl>120</ttl>
<item><title>0</title></item>
<item><title>1</title></item>
@ragaskar
ragaskar / parse_limit
Last active December 20, 2015 07:29
Demonstrates nokogiri parse limit at 64 records.
require 'nokogiri'
string = <<-STRING
<rss version="2.0">
<channel>
<title>thing</title>
<link>http://thing</link>
<description>blah</description> <language>en-us</language>
<ttl>120</ttl>
<item> <title>Here's some title 0!!!</title> <link>http://some-crazy-link<link> <guid isPermaLink="true">some-other-crazy-link<guid> <comments>still more links</comments> <pubDate>Wed, 24 Jul 2013 12:08:37 +0000</pubDate> <description>What a cool description</description> <enclosure url="oh-my-god-so-many-links"/> </item>
<item> <title>Here's some title 1!!!</title> <link>http://some-crazy-link<link> <guid isPermaLink="true">some-other-crazy-link<guid> <comments>still more links</comments> <pubDate>Wed, 24 Jul 2013 12:08:37 +0000</pubDate> <description>What a cool description</description> <enclosure url="oh-my-god-so-many-links"/> </item>
@ragaskar
ragaskar / touch_params.yml
Created September 14, 2012 00:12
TouchParams
name: "Default Touch Params"
longTapDelay: 750
distanceToScrollPriority: 50
distanceTriggeringHorizontalSwipe: 15
distanceTriggeringVerticalSwipe: 14
@ragaskar
ragaskar / show-branches.sh
Created September 12, 2012 14:14
Show branch times
for k in `git branch -r|perl -pe s/^..//`;do echo -e `git show --pretty=format:"%Cgreen%ci %Cblue%cr %Cred%cn %Creset" $k|head -n 1`\\t$k;done|sort -r
@ragaskar
ragaskar / .ackrc
Created January 7, 2012 17:41
Add haml recognition to Ack so searches return view files
--type-set
haml=.haml
@ragaskar
ragaskar / 1-before_spec.rb
Created November 19, 2011 16:09 — forked from richievos/1-before_spec.rb
Spectastrophe #1
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe "Something doppelganger" do
describe "RailCar" do
let(:gateway) { RailCar.new :login => "a", :password => "b" }
describe "#commit" do
let(:response) { railcar.send :commit, request, {} }
describe "response" do