Skip to content

Instantly share code, notes, and snippets.

View bugant's full-sized avatar

Matteo Centenaro bugant

  • Mestre, Venice (Italy)
View GitHub Profile
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
boundProp: "initial value"
});

Keybase proof

I hereby claim:

  • I am bugant on github.
  • I am bugant (https://keybase.io/bugant) on keybase.
  • I have a public key whose fingerprint is 1C65 1880 62C6 6ED5 D6D1 9B5C D7EE A8AE 294F B43C

To claim this, I am signing this object:

@bugant
bugant / foo.rb
Last active August 29, 2015 13:57
Trying to reproduce resque-scheduler #369 issue
require 'resque-scheduler'
class Foo
def self.queue
:foo
end
def message
'hello from foo'
end
@bugant
bugant / gist:7821322
Created December 6, 2013 09:59
Using redis-cli to configure Redis save option
matteo@fungo ~$ redis-cli
redis 127.0.0.1:6379> config get save
1) "save"
2) "3600 1 300 100 60 10000"
redis 127.0.0.1:6379> config set save "3600 2 200 50"
OK
redis 127.0.0.1:6379> config get save
1) "save"
2) "3600 2 200 50"
redis 127.0.0.1:6379>
@bugant
bugant / rails_api_template.rb
Created July 19, 2013 14:58
Template to generate a basic rails-api application. It includes RSpec2, ActiveModel::Serializers and uses strong parameters (ActionController::StrongParameters).
gem 'rails-api'
gem 'active_model_serializers'
gem_group :development, :test do
gem 'debugger'
gem 'rspec-rails'
gem 'shoulda-matchers'
gem 'factory_girl_rails'
end
@bugant
bugant / dining_philosophers.rb
Last active December 30, 2015 08:16
Dining Philosophers solution using Celluloid
#!/usr/bin/env ruby
require 'rubygems'
require 'bundler/setup'
require 'celluloid'
class Table
include Celluloid
CHOPSTICK_FREE = 0
CHOPSTICK_USED = 1
@bugant
bugant / gist:4483304
Last active August 14, 2019 01:53
DCI implemented using SimpleDelegator to save method caching
require 'delegate'
class Account < Struct.new(:owner, :amount)
end
class MoneyTransferContext < Struct.new(:source, :destination)
def transfer(amount)
# applico i ruoli ai modelli "stupidi"
source_account = SourceRole.new(source)
destination_account = DestinationRole.new(destination)
@bugant
bugant / stupid-udp-server.rb
Created February 22, 2012 16:46
em-synchrony stupid udp server
require "em-synchrony"
require "em-synchrony/em-http"
class EchoUdpServer < EventMachine::Connection
def post_init
@f = Fiber.current
end
def receive_data(data)
@f.resume(data)