Skip to content

Instantly share code, notes, and snippets.

Avatar

Rajan Agaskar ragaskar

View GitHub Profile
View rando.rb
######################
# 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
Getting Rails HTML from Controllers (without instantiation) programmatically in a rake task
View gist:3ec13eea2bdce1f07ad3
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 Aug 29, 2015
CloudController Repository Pattern
View aggregates_current_organization.rb
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
View jasmine-boot-for-fiddle.js
/**
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 Dec 20, 2015
demonstrates that nokogiri has no problem if the content is not large.
View no_parse_limit.rb
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 Dec 20, 2015
Demonstrates nokogiri parse limit at 64 records.
View parse_limit
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>
View touch_params.yml
name: "Default Touch Params"
longTapDelay: 750
distanceToScrollPriority: 50
distanceTriggeringHorizontalSwipe: 15
distanceTriggeringVerticalSwipe: 14
View show-branches.sh
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 Jan 7, 2012
Add haml recognition to Ack so searches return view files
View .ackrc
--type-set
haml=.haml
View 1-before_spec.rb
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
You can’t perform that action at this time.