Skip to content

Instantly share code, notes, and snippets.

View storuky's full-sized avatar

Kononenko Pavel storuky

View GitHub Profile
GIT
remote: [email protected]:storuky/carrierwave-crop.git
revision: 8c5a446eda9eeedc20a7a6668744e7f41db4f0cd
branch: master
specs:
carrierwave-crop (0.1.2)
carrierwave
jquery-rails
rails (>= 3.2)
@storuky
storuky / gist:73e202707d3c7e402ad2
Last active March 22, 2016 11:41
Flickity lightbox
app.directive('lightbox', ['$compile', '$timeout', '$rootScope', 'Image', function($compile, $timeout, $rootScope, Image) {
// Runs during compile
return {
// name: '',
// priority: 1,
// terminal: true,
scope: {
images: "=",
allowDestroy: "=",
upload: "="
module Sidekiq::Middleware::DefaultUrlOptions
class Client
def call(worker_class, msg, queue, redis_pool)
msg['default_url_options'] = ActionMailer::Base.default_url_options
yield
end
end
class Server
def call(worker, msg, queue)
module Cacheable
extend ActiveSupport::Concern
included do
after_commit :clear_cache
private
def clear_cache
Rails.cache.delete_matched(/#{self.class.to_s}\.cache\.all/)
Rails.cache.delete_matched(/#{self.class.to_s}\.cache\.find\(#{self.id}\)/)
app.directive('clickOutside', ['$document', function ($document) {
return {
restrict: 'A',
scope: {
clickOutside: '&'
},
link: function (scope, el, attr) {
var handler = function (e) {
if (el !== e.target && !el[0].contains(e.target) && document.body.contains(e.target)) {
scope.$apply(function () {