Skip to content

Instantly share code, notes, and snippets.

View hubb's full-sized avatar
🕳️
🐇

Thibault Gautriaud hubb

🕳️
🐇
View GitHub Profile
@ludyna
ludyna / dci_example.rb
Last active March 20, 2018 20:08
DCI (Data, Contexts, Interactions) paradigm example in Ruby
# DCI EXAMPLE IN RUBY (with some prototype elements)
# Blog post: https://www.ludyna.com/oleh/dci-example-in-ruby
#
# More info:
#
# Creator of MVC & DCI, Trygve Reenskaug: DCI: Re-thinking the foundations of
# object orientation and of programming
# http://vimeo.com/8235394
#
# James Coplien: Why DCI is the Right Architecture for Right Now
@JunichiIto
JunichiIto / alias_matchers.md
Last active April 16, 2024 16:18
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
@nisanthchunduru
nisanthchunduru / delete_failed_jobs.rb
Last active September 15, 2022 18:37
Selectively remove/retry failed jobs in Resque 1.x
def delete_failed_job_if
redis = Resque.redis
(0...Resque::Failure.count).each do |i|
string = redis.lindex(:failed, i)
break if string.nil?
job = Resque.decode(string)
should_delete_job = yield job
next unless should_delete_job
@wycats
wycats / app.js
Last active February 11, 2016 16:08
App.Router.map(function() {
this.resource('post', { path: '/posts/:post_id' });
});
App.PostRoute = Ember.Route.extend({
model: function(params) {
return this.store.find('post', params.post_id);
}
});
@blowmage
blowmage / tasks_controller_refactoring.rb
Created November 12, 2012 16:52 — forked from ryanb/tasks_controller_refactoring.rb
Variation of RubyTapas episode "021 Domain Model Events" without callbacks, using dirty, and keeping the tracker object.
class TasksController < ApplicationController
def update
if @task.update_attributes(params[:task])
tracker = PostSaveTaskTracker.new(@task)
TaskPusher.new(tracker, socket_id).push_changes
TaskMailSender.new(tracker, current_user).deliver_email
# success response
else
# failure respond
end
@xdite
xdite / 42-things.md
Created July 14, 2012 05:11
Ten (42) Things You Didn't Know Rails Could Do
@sinisterchipmunk
sinisterchipmunk / LICENSE
Last active September 8, 2023 17:57
tar, gzip, and untar files using ruby in memory without tempfiles
Copyright (C) 2011 by Colin MacKenzie IV
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in