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
| # source: http://stackoverflow.com/questions/3800202/diff-output-from-two-programs-without-temporary-files | |
| diff -y <(git st | grep rb | cut -c 4-) <(find app -name *product.rb) |
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
| #!/bin/bash | |
| # Usage: gb rename [gorename options] | |
| # Example: | |
| # | |
| # gb rename -from '"mypackage".AwesomeStruct' -to "EvenMoreAwesomeStruct" | |
| # | |
| # Install: drop this file on your $PATH somewhere ($HOME/bin seems cool) and you're done. | |
| if [ "$1" = "help" ]; then | |
| gorename --help |
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
| # Elm integration for Sprockets 3.x (Rails 4.2) | |
| # | |
| # Revised version of a Sprockets 3.x processor for Elm. It supports | |
| # dependencies. One little quirk is that only .js.elm files are | |
| # requireable in application.js. | |
| # | |
| # How to use it? | |
| # | |
| # Put this file in your config/initializers/ and create | |
| # app/assets/javascripts/MyModule.js.elm and require it in your |
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
| $ docker run --rm -it ruby:2.2 ruby -ruri -e "puts URI('http://accessibility_checker.siteimprove.com')" | |
| http://accessibility_checker.siteimprove.com | |
| $ docker run --rm -it ruby:2.1 ruby -ruri -e "puts URI('http://accessibility_checker.siteimprove.com')" | |
| /usr/local/lib/ruby/2.1.0/uri/generic.rb:214:in `initialize': the scheme http does not accept registry part: accessibility_checker.siteimprove.com (or bad hostname?) (URI::InvalidURIError) | |
| from /usr/local/lib/ruby/2.1.0/uri/http.rb:84:in `initialize' | |
| from /usr/local/lib/ruby/2.1.0/uri/common.rb:214:in `new' | |
| from /usr/local/lib/ruby/2.1.0/uri/common.rb:214:in `parse' | |
| from /usr/local/lib/ruby/2.1.0/uri/common.rb:747:in `parse' | |
| from /usr/local/lib/ruby/2.1.0/uri/common.rb:1232:in `URI' | |
| from -e:1:in `<main>' |
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
| # Rails autoloading constant functionality is useful until it's not. | |
| # Every class is placed in the right file on the right path. | |
| # in app/models/users/serializer.rb | |
| module Users | |
| class Serializer | |
| #... | |
| 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
| namespace :db do | |
| namespace :fixtures do | |
| desc 'Load fixtures into postgres' | |
| task :pg => [:environment, :load_config] do | |
| require 'active_record/fixtures' | |
| require 'postgres_foreign_keys' | |
| module ActiveRecord::ConnectionAdapters::PostgreSQL::ReferentialIntegrity | |
| def supports_disable_referential_integrity? | |
| 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
| class PgEnum | |
| attr_reader :type | |
| def initialize(type) | |
| @type = type.to_s | |
| end | |
| class << self | |
| alias_method :for_type, :new | |
| 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
| # A sample Gemfile | |
| source "https://rubygems.org" | |
| gem 'activerecord' | |
| gem 'mongoid' | |
| gem 'sqlite3' | |
| gem 'ransack' |
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
| # functions | |
| function gcd () | |
| { | |
| local pdir=$(go list -f '{{ .Dir }}' $1 2>/dev/null ) | |
| if [ -z "$pdir" ]; then | |
| pdir=$(go list -f '{{ .Dir }}' ".../$1" 2>/dev/null) | |
| fi | |
| if [ -z "$pdir" ]; then | |
| echo "no directory found for pkg $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
| package email | |
| import ( | |
| "net/smtp" | |
| "testing" | |
| ) | |
| type EmailConfig struct { | |
| Username string | |
| Password string |