Skip to content

Instantly share code, notes, and snippets.

View djbender's full-sized avatar
🕵️‍♂️

Derek Bender djbender

🕵️‍♂️
View GitHub Profile
AWS.config(access_key_id: ENV['AWS_ACCESS_KEY_ID'],
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'] )
S3_BUCKET = AWS::S3.new.buckets[ENV['S3_BUCKET']]
@tomstuart
tomstuart / gist:4382332089a8402bf475
Created April 30, 2014 12:59
Person#age gives the wrong answer for a person who hasn’t had their birthday yet this year
require 'active_support/time'
require 'active_support/testing/time_helpers'
require 'rspec/expectations'
include ActiveSupport::Testing::TimeHelpers
include RSpec::Matchers
class Person < Struct.new(:birthday)
def age
Date.today.year - birthday.year
end
@jodosha
jodosha / explanation.md
Last active August 29, 2015 14:00
Lotus::Repository: class vs instance methods

Given that an adapter brings its own query API, the implementation of the finders depends on the interface of the current adapter's query.

class ArticleRepository
  include Lotus::Repository

  def self.most_recent(limit = 5)
    query do
      desc(:created_at)
    end.limit(limit)
#=Navigating=
visit('/projects')
visit(post_comments_path(post))
#=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click_on('Button Value')
#Sort the Ruby files in your project by number of has_many
ack " has_many " -c | awk -F ":" '{print $2,$1}' | grep -v "0" | sort -rn
accomplished
aggravated
amused
angry
annoyed
anxious
apathetic
artistic
awake
bitchy
@jodosha
jodosha / Gemfile
Last active December 9, 2020 15:09
Full stack Lotus application example
source 'https://rubygems.org'
gem 'rake'
gem 'lotus-router'
gem 'lotus-controller'
gem 'lotus-view'
group :test do
gem 'rspec'
gem 'capybara'
@jodosha
jodosha / lotus_presenter.rb
Last active August 29, 2015 13:57
A Lotus::View sneak peek: Lotus::Presenter
module Lotus
module Presenter
def initialize(object)
@object = object
end
protected
def method_missing(m, *args, &blk)
if @object.respond_to?(m)
@object.__send__ m, *args, &blk
@anikalindtner
anikalindtner / gist:9524950
Last active March 1, 2023 11:52
Workshops/Mailinglists/Lists
Start every day coding, end every day thinking.
1. Warmup exercise (30 mins)
Make sure to have these ready the night before, pick stuff
that you can work on right away without having to study
in advance.
They can either be book exercises or stuff
from other sources, but they should be self-verifiable