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 ExtendFields | |
| require "yaml" | |
| private | |
| def extend_fields | |
| dynamic_fields.each { |name, type| self.class.field name, type: type } | |
| end | |
| def dynamic_fields | |
| YAML.load_file( File.join( Rails.root, 'config', 'class_fields', "#{self.class.name.underscore}.yml" ) ) rescue {} |
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
| #Simple form Input class for arrays | |
| class ArrayInput < SimpleForm::Inputs::Base | |
| def input | |
| #override the attribute name for arrays to allow rails to handle array forms | |
| input_html_options.merge!({:name => "#{self.object_name}[#{attribute_name}][]"}) | |
| @builder.text_field(attribute_name, input_html_options) | |
| 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
| #Simple form Input class for a hash | |
| class HashInput < SimpleForm::Inputs::Base | |
| def input | |
| key = input_html_options.delete(:key) | |
| #override the params to be in the format that rails will auto correlate back to an | |
| # attribute hash with key: value | |
| input_html_options.merge!({:name => "#{self.object_name}[#{attribute_name}][#{key}]"}) | |
| @builder.text_field(attribute_name, input_html_options) | |
| 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
| class TriBoolean | |
| attr_reader :value | |
| def initialize(value) | |
| @value = value | |
| end | |
| # Converts an object of this instance into a database friendly value. | |
| def mongoize |
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
| /* | |
| * CSS Media queries for responsive tables | |
| * http://stackoverflow.com/questions/9746979/tables-in-a-responsive-web-design | |
| * and http://css-tricks.com/responsive-data-tables/ | |
| * | |
| * http://jsfiddle.net/camallen/gvExW/5/ | |
| /* | |
| @media all and (max-width:640px) { | |
| table,thead,tbody,tfoot,th,td,tr{display: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
| for i in `gem list --no-versions`; do gem uninstall -aIx $i; done |
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 'spec_helper' | |
| describe Project, type: :model do | |
| let(:project) { build(:project) } | |
| it "should have a valid factory" do | |
| expect(project).to be_valid | |
| 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 | |
| # Create a JSON file of all the penguin subject images in the s3 bucket | |
| # combined with the per site/filename provided metadata in CSV files. | |
| require 'aws-sdk' | |
| require 'json' | |
| require 'csv' | |
| require 'active_support' | |
| require 'zooniverse_data' | |
| require 'pry' |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
| <title>SoundCloud OAuth 2 User Agent Authentication Flow Demo</title> | |
| <script type="text/javascript" charset="utf-8" src="javascript/jquery-1.4.2.js"></script> | |
| <script type="text/javascript" charset="utf-8"> | |
| $(function () { | |
| var extractToken = function(hash) { |
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
| function dethrottle { | |
| sudo ipfw delete 1 | |
| } | |
| function throttle { | |
| if test $# -eq 0 | |
| then | |
| echo 'throttle <port> <bandwidth (KB)>' | |
| elif test $# -eq 1 | |
| then |
OlderNewer