Skip to content

Instantly share code, notes, and snippets.

Avatar
🌸
Working on Hanami 2 views+actions integration

Tim Riley timriley

🌸
Working on Hanami 2 views+actions integration
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am timriley on github.
  • I am timriley (https://keybase.io/timriley) on keybase.
  • I have a public key whose fingerprint is 1553 921F DE6E 0649 177E CC44 747A BA12 82E8 8BC9

To claim this, I am signing this object:

@timriley
timriley / Rakefile
Created Aug 22, 2018
Methods defined in Rakefile added to every object, via Kernel
View Rakefile
class MyClass
end
def foo_from_rake_top_level
"foo"
end
namespace :testing do
def foo_from_rake_namespace
"foo"
@timriley
timriley / example.rb
Created Jan 10, 2017
Example of dry-validation predicate for "unique within some scope"
View example.rb
UserSchema = Dry::Validation.Schema do
configure do
# Hard-coding the custom error messages
def self.messages
Dry::Validation::Messages.default.merge(
en: {errors: {unique_within_account?: 'is not unique within this account'}}
)
end
# Here's the custom predicate
@timriley
timriley / Gemfile
Created Nov 3, 2016
dry-auto_inject strategy for Trailblazer 2 operations
View Gemfile
source "https://rubygems.org"
gem "dry-auto_inject"
@timriley
timriley / Tim's Tokyo Coffee Highlights.md
Last active Oct 9, 2016
Tim's Tokyo Coffee Highlights
View Tim's Tokyo Coffee Highlights.md

Tim’s Tokyo coffee highlights

Shimokitazawa

Bear Pond: Kind of “famous” I think, coffee-focused to the point of arrogance, but Shimokitazawa is an awesome neighbourhood worth visiting anyway (and I bet there are other good cafes around now too).

Around Yoyogi Park

Fuglen: Nicely designed Scandi-style place, very relaxed.

@timriley
timriley / shell session.txt
Created Jul 23, 2016
rspec output for new dry-web-roda app
View shell session.txt
~/S/my_new_app $ ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
~/S/my_new_app $ bundle show
Gems included by the bundle:
* addressable (2.4.0)
* bundler (1.12.3)
* byebug (9.0.5)
* capybara (2.7.1)
* capybara-screenshot (1.0.13)
@timriley
timriley / _pagination.slim
Created Jan 12, 2016
Rodakase/ROM pagination
View _pagination.slim
nav.pagination
- unless first_page?
span.first
a href=url_for_page(1)
| « First
span.prev
a href=url_for_page(prev_page) rel="prev"
| ‹ Prev
- if prev_gap?
span.page.gap
@timriley
timriley / gist:11f6716217b49c4b45a2
Last active Aug 29, 2015
Workaround for dismissViewControllerAnimated failing to animate a stack of modal view controllers
View gist:11f6716217b49c4b45a2
- (void)loginViewControllerDidClose:(DSLoginViewController *)loginViewController
{
// HACK
//
// Work around a bug(?) where the login VC's view disappears immediately
// (without animation) before our own view then animates away. We want
// only the login VC's view to animate, with all underlying views
// disappearing (invisibly) underneath at the same time. AFAICT, this is
// what _should_ happen:
//
View twitter_notifications_only.css
/*
Just the Notifications, please
==============================
1. Make a Fluid (http://fluidapp.com/) instance of https://twitter.com/i/notifications
2. Apply the below CSS as a Userstyles stylesheet
3. Enjoy just the conversation, not the timeline
Why?
View modularise.rb
Dir["#{Rails.root}/app/*/**"].each do |dir|
case File.basename(dir)
when 'assets'
Dir["#{dir}/*"].each do |assets_dir|
Rails.application.config.assets.paths << assets_dir
Dir["#{assets_dir}/*"].each do |asset|
parts = File.basename(asset).split('.')
name = "#{parts.first}.#{parts.second}"
Rails.application.config.assets.precompile += [name]
end
You can’t perform that action at this time.