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
| # browser_logging.rb will print out the browser log from Chrome | |
| # when running specs with "js: true". This is so we can easily debug | |
| # issues where there are JS errors or other console warnings/error(s), etc. | |
| # | |
| # Output file is: Rails.root/log/browser.log | |
| # | |
| # Note: Nothing will be printed out for non-JS examples. | |
| RSpec.configure do |config| | |
| browser_log = File.new(Rails.root.join("log/browser.log").to_s, "w") | |
| browser_log.sync = 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
| DIR = File.dirname(__FILE__) | |
| BRIDGESUPPORT_FILE = "BridgeSupport.bridgesupport" | |
| namespace :gen do | |
| desc "Generates the bridgesupport file for RubyMotion" | |
| task :bridgesupport do | |
| Dir.chdir(DIR) do | |
| SHELL_COMMAND=<<-EOS.gsub(/^\s*/, '') |
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 | |
| # | |
| # Prints out top 5 contributors per file (as determined by # of commits) on every file in the repository | |
| # | |
| files = `git ls-files`.lines.map(&:chomp) | |
| stats_by_file = {} | |
| files.each_with_index do |file, index| |
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
| camelCasedPayload = OliveBranch::Transformations.transform( | |
| { key.to_sym => payload }, | |
| OliveBranch::Transformations.method(:camelize) | |
| ) |
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 StructThatDisallowsNil | |
| def self.new(*args) | |
| Struct.new(*args).tap do |klass| | |
| klass.prepend Module.new { | |
| def initialize(*) | |
| super | |
| members.each do |member| | |
| fail "#{member} cannot be nil" if send(member).nil? | |
| 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
| DisableSettingInverse.disabled = true | |
| child = Child.new(parent_id: 12345) | |
| parent = Parent.new | |
| parent.children = [child] | |
| child.parent_id # => 12345 | |
| DisableSettingInverse.disabled = false |
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 bash | |
| # Show how to check, save, restore the errexit shell option that is commonly set | |
| # using "set -e". This is useful for functions that care about non-zero exit statuses | |
| # and want to do something because of it such as a retry function. | |
| set -eu | |
| echo "Shell options: $-" |
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 | |
| require "optparse" | |
| SCRIPT_NAME = File.basename(__FILE__) | |
| ARGS_TO_FORWARD = ARGV.dup | |
| ARGV.delete_if { |arg| arg !~ /-h|--help/ } | |
| OptionParser.new do |opts| |
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
| # | |
| # Add the following to Middleman's config.rb: | |
| # | |
| CoffeeScript.class_eval do | |
| class << self | |
| def compile_with_bare(*args) | |
| options = args.pop if args.last.is_a?(Hash) | |
| (options ||= {})[:bare] = true | |
| args << options |
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 bash | |
| # A simple front-end for running git unmerged in a project-specific way. | |
| # | |
| # ## Options | |
| # | |
| # -l for local comparing against local branches. The default is to compare against remote branches. | |
| # | |
| INCLUDE_BRANCH_CONVENTION="rails5/" |
NewerOlder