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
| class ResquePaperclipJob | |
| @queue = :paperclip | |
| def self.perform(instance_klass, instance_id, attachment_name) | |
| instance = instance_klass.constantize.find(instance_id) | |
| instance.send("#{attachment_name}_processing!", :save => true) | |
| begin | |
| instance.send(attachment_name).reprocess! | |
| instance.send("#{attachment_name}_processed!") | |
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
| class DelayedPaperclipJob < Struct.new(:instance_klass, :instance_id, :attachment_name) | |
| def perform | |
| instance = instance_klass.constantize.find(instance_id) | |
| instance.send("#{attachment_name}_processing!", :save => true) | |
| begin | |
| instance.send(attachment_name).reprocess! | |
| instance.send("#{attachment_name}_processed!") | |
| rescue Exception => e | |
| instance.send("#{attachment_name}_processing!", :save => true) |
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
| # RUN IN CPS | |
| require 'spec/factories' | |
| footage_user = Factory(:footage_contributor, | |
| :aip_id => "7c15b020-1b5d-012d-be98-64b9e8c74a0e", | |
| :email => "[email protected]", | |
| :first_name => "Adam", | |
| :last_name => "Pearson", | |
| :is_enrolled => true | |
| ) |
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 Jekyll | |
| require 'haml' | |
| class HamlConverter < Converter | |
| safe true | |
| priority :low | |
| def matches(ext) | |
| ext =~ /haml/i | |
| 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
| #!/usr/bin/env ruby | |
| def run(cmd) | |
| puts ">> #{cmd}" | |
| puts `#{cmd}` | |
| end | |
| branch = ARGV[0] | |
| remote = branch.split("/")[0] | |
| name = branch.split("/")[1] |
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
| var rules = {"email-address":{minlength:10}} | |
| // or var validations = { rules: {...}, messages: {...} } | |
| for(fieldName in rules){ | |
| var element = $('input[name="' + fieldName + '"]'); | |
| var fieldRules = rules[fieldName] | |
| for(ruleName in fieldRules){ | |
| var rule = {}; | |
| rule[ruleName] = fieldRules[ruleName]; |
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
| var numbers = [1,2,3,4]; | |
| var numObject = { | |
| 1: 1, | |
| 2: 2, | |
| 3: 3, | |
| 4: 4 | |
| } | |
| var funcs = []; |
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
| #!/usr/bin/env ruby | |
| path = ARGV[0] | |
| dir = File.dirname(path) | |
| `mkdir -p #{File.dirname(path)}; touch #{path}` |