Skip to content

Instantly share code, notes, and snippets.

  • Standup
    • Zoom
  • Retro
    • Zoom (per meeting invite)
    • Remote retro or other
  • Sprint Planning
    • Zoom (per meeting invite)
    • Trello
  • Card Kickoff
  • Zoom (adhoc)
require 'rails_helper'
RSpec.describe FileIntegrityValidator do
class TestClass
include ActiveModel::Model
attr_accessor :file_path, :content_type
validates_with FileIntegrityValidator
end
@dangalipo
dangalipo / calculator.rb
Created January 19, 2017 01:53
Wacky Calulator
# invoke with ruby calculator.rb
class Calculator
def initialize
self.result = 0
end
def add(value)
self.result = result + value
print_result
@dangalipo
dangalipo / gist:a1fd86df39f2711c0ef092b38b1e7fab
Created November 24, 2016 02:39
This is probably made of fail can someone tell me why....
class ApplicationController < ActionController::Base
before_filter :store_request_and_session_ids
private
def store_request_and_session_ids
Thread.current[:request_id] ||= request.uuid
Thread.current[:session_id] ||= session.id
end
end
def create
@institution = Institution.new(institution_params.except(:admin), as: :admin)
if @institution.save_with_admin(login: institution_params[:admin]
redirect_to admin_institutions_path, flash: {
success: "Institution created."
}
else
flash.now[:error] = 'Unable to create institution.'
render :new
end
Country.where(code: "AU").shipping_costs.joins(:currency).merge(Currency.where(code: "AUD"))
require 'httparty'
def last_deploy_tag
tag = ""
Open3.popen3("git describe --tags `git rev-list --tags --max-count=1`") do |i, o, e, t|
tag = o.read.chomp
end
tag
end
def do_barrell_roll
end
@dangalipo
dangalipo / gist:b77f04a02101a9686c83
Created March 26, 2015 01:00
openstruct factories
require "ostruct"
FactoryGirl.define do
factory :foo do
bar { "moo" }
end
end
@dangalipo
dangalipo / gist:b5580b9730eaa03aeb90
Created March 2, 2015 02:26
profiling results lazy(foo) vs non_lazy(moo)
c =[#<CaseComponent id: 99712, case_id: 34007, position: 1, itemable_id: 4744, itemable_type: "QuizQuestion">, #<CaseComponent id: 99674, case_id: 34007, position: 1, itemable_id: 34007, itemable_type: "Presentation">, #<CaseComponent id: 99711, case_id: 34007, position: 2, itemable_id: 4743, itemable_type: "QuizQuestion">, #<CaseComponent id: 99710, case_id: 34007, position: 3, itemable_id: 4742, itemable_type: "QuizQuestion">, #<CaseComponent id: 99709, case_id: 34007, position: 4, itemable_id: 4741, itemable_type: "QuizQuestion">, #<CaseComponent id: 99708, case_id: 34007, position: 5, itemable_id: 4740, itemable_type: "QuizQuestion">, #<CaseComponent id: 99707, case_id: 34007, position: 6, itemable_id: 4739, itemable_type: "QuizQuestion">, #<CaseComponent id: 99704, case_id: 34007, position: 7, itemable_id: 4737, itemable_type: "QuizQuestion">, #<CaseComponent id: 99702, case_id: 34007, position: 8, itemable_id: 4736, itemable_type: "QuizQuestion">, #<CaseComponent id: 99700, case_id: 34007, position: 9,