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
| config = Rails.application.config | |
| default_precompile = config.assets.precompile | |
| config.assets.precompile = [ | |
| proc do |path| | |
| if path =~ /bower_components/ | |
| false | |
| else | |
| default_precompile.call(path) |
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
| require 'tmpdir' | |
| require 'securerandom' | |
| class Assassin | |
| def Assassin.ate(*args, &block) | |
| new(*args, &block) | |
| end | |
| attr_accessor :parent_pid | |
| attr_accessor :child_pid |
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
| # when you really, really, really want to make sure your children get cleaned up you can generate a script | |
| # that detaches and monitors *you*. if you disappear the assassin can ensure cleanup happens. even if | |
| # you are 'kill -9d' or call 'exit!' | |
| assassin = <<-__ | |
| pid = #{ Process.pid } | |
| 4242.times do | |
| begin | |
| Process.kill(0, pid) |
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
| # encoding: utf-8 | |
| # | |
| companies = Company.where(:locale => 'ko') | |
| domains = Domain.where(:company_id.in => companies.map(&:id)) | |
| domains.destroy_all | |
| companies.destroy_all | |
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
| <!-- | |
| using ids is effectively just like using a GOTO statement in code - it pins | |
| logic to jump to a pre-labeled and identified spot by unique label/id. this | |
| lets you avoid needing to make a good design. | |
| --> |
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
| # mongoid style | |
| # | |
| module A | |
| end | |
| class B | |
| include A | |
| end |
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
| # | |
| if ENV['DATO_DUMP'] | |
| command = "./bin/rake dato:dump" | |
| STDOUT.puts command | |
| unless system(command) | |
| abort "command (#{ command }) failed with (#{ $? })" | |
| end | |
| end |
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
| # | |
| require 'fileutils' | |
| require 'dato' | |
| require 'map' | |
| require 'coerce' | |
| require 'pry' | |
| # | |
| token = ARGV.shift |
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
| # Util.bcall(arg_1, arg_2, &callback) | |
| module Util | |
| def bcall(*args, &block) | |
| call(block, :call, *args) | |
| end | |
| def call(object, method, *args, &block) | |
| args = args_for_arity(args, object.method(method).arity) | |
| object.send(method, *args, &block) |
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
| key: val |