GitHub::SQL has been released as an officially-maintained project and ruby gem: github/github-ds.
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
| # @return [Array<String>] | |
| def gem_paths | |
| Gem.path.flat_map { |path| Dir.glob("#{path}/gems/*") } | |
| end | |
| # @param [String] gem_name | |
| # @return [Boolean] | |
| # @raise [LoadError] | |
| def require_gem(gem_name) | |
| if defined?(::Bundler) |
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
| # RSpec matcher for validates_with. | |
| # https://gist.github.com/2032846 | |
| # Usage: | |
| # | |
| # describe User do | |
| # it { should validate_with CustomValidator } | |
| # end | |
| RSpec::Matchers.define :validate_with do |expected_validator, options| | |
| match do |subject| | |
| @validator = subject.class.validators.find do |validator| |
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
| defmodule UserQueries do | |
| def in_organization(query \\ User, organization) do | |
| from u in query, | |
| where: u.organization_id == ^organization.id | |
| end | |
| def in_patricks_family(query \\ User) do | |
| from u in query, | |
| where: u.last_name == ^"Van Stee" | |
| 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
| # Add the following to your .bash_profile or .bashrc file in order to switch to a different iTerm profile during an ssh session. | |
| # This same code could be re-purposed for any command, not just ssh | |
| # Set iTerm2 Profile | |
| set_iterm_profile() { | |
| echo -e "\033]50;SetProfile=$1\a" | |
| } | |
| # Switch iTerm2 Profile during SSH Sessions | |
| ssh() { |
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
| Your name and email address were configured automatically based | |
| on your username and hostname. Please check that they are accurate. | |
| You can suppress this message by setting them explicitly: | |
| git config --global user.name "Your Name" | |
| git config --global user.email you@example.com | |
| After doing this, you may fix the identity used for this commit with: | |
| git commit --amend --reset-author |