This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}\)/) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: "=" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GIT | |
remote: [email protected]:storuky/carrierwave-crop.git | |
revision: 8c5a446eda9eeedc20a7a6668744e7f41db4f0cd | |
branch: master | |
specs: | |
carrierwave-crop (0.1.2) | |
carrierwave | |
jquery-rails | |
rails (>= 3.2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// api.js | |
export const GetAllProjects = () => Vue.http.get('/swage/v1/projects') | |
// resources/Project.js | |
import Vue from 'vue'; | |
export default Vue.resource( | |
"v1/projects{/id}", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// api.js | |
export const GetAllProjects = () => Vue.http.get('/swage/v1/projects') | |
// resources/Project.js | |
import Vue from 'vue'; | |
export default Vue.resource( | |
"swage/v1/projects{/id}", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spread(value) { | |
return (Math.random() - 0.5) * value * 2 | |
}, | |
transformGeneratePersonObjects(){ | |
// we could do something much smarter with object layout, but let's keep it simple | |
const { x, y } = this.baseObject.position; | |
// iterate over our Shareholders array | |
this.shareholders.forEach(shareholder => { | |
const position = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { log } = console; | |
const foo = word => { | |
const bar = word => setTimeout(() => log(word), word.length) | |
bar(word); | |
return bar; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const operation = a => b => c => a * b + c; | |
operation('2')(3)('4') |
OlderNewer