Skip to content

Instantly share code, notes, and snippets.

🤓
🦀

Felipe Lima felipecsl

🤓
🦀
Block or report user

Report or block felipecsl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@felipecsl
felipecsl / GifDecoder.java
Last active Mar 28, 2019
Android custom ImageView that handles animated GIFs.
View GifDecoder.java
/**
* Copyright (c) 2013 Xcellent Creations, Inc.
*
* 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:
@felipecsl
felipecsl / restart coreaudio daemon
Created Mar 16, 2013
Restart Mac OS X coreaudio daemon. Useful if you cannot change the audio output device to Airplay.
View restart coreaudio daemon
sudo kill `ps -ax | grep 'coreaudiod' | grep 'sbin' |awk '{print $1}'`
@felipecsl
felipecsl / after_commit_with_transactional_fixtures.rb
Created Nov 3, 2011 — forked from outoftime/after_commit_with_transactional_fixtures.rb
Patch ActiveRecord to fire after_commit callbacks at the appropriate time during tests with transactional fixtures.
View after_commit_with_transactional_fixtures.rb
module ActiveRecord
module ConnectionAdapters
module DatabaseStatements
#
# Run the normal transaction method; when it's done, check to see if there
# is exactly one open transaction. If so, that's the transactional
# fixtures transaction; from the model's standpoint, the completed
# transaction is the real deal. Send commit callbacks to models.
#
# If the transaction block raises a Rollback, we need to know, so we don't
View Mongoid connection snippet for MongoHQ + Heroku
Mongoid.configure do |config|
if ENV['RACK_ENV'] == 'development' # ambiente de desenvolvimento
name = "myapp_development"
host = "localhost"
config.master = Mongo::Connection.new.db(name)
config.slaves = [ Mongo::Connection.new(host, 27017, :slave_ok => true).db(name) ]
else # ambiente de produção
uri = URI.parse(ENV['MONGOHQ_URL'])
config.master = Mongo::Connection.from_uri(ENV['MONGOHQ_URL']).db(uri.path.gsub("/", ""))
end
You can’t perform that action at this time.