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 ApplicationRecord < ActiveRecord::Base | |
| self.abstract_class = true | |
| def self.pluck_to_hash(*column_names, **aliased_columns) | |
| column_names = self.column_names.map(&:to_sym) if column_names.blank? && aliased_columns.blank? | |
| columns_to_pluck = column_names + aliased_columns.values | |
| keys = column_names + aliased_columns.keys | |
| pluck(*columns_to_pluck).map do |row| |
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 File.expand_path('../../config/environment', __FILE__) | |
| Rails.application.eager_load! | |
| def build_tree(branch, ancestors) | |
| return if ancestors.empty? | |
| first, *tail = *ancestors |
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
| Pry::Commands.command /^up_app$/, "jump up the stack to next application code" do | |
| start_frame = Byebug.current_context.frame.pos + 1 | |
| frame = (start_frame...Byebug.current_context.stack_size).find do |index| | |
| !Byebug::Frame.new(Byebug.current_context, index).file.start_with?(Gem.dir) | |
| end | |
| _pry_.run_command "frame #{frame}" | |
| 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 BisectFormatter < RSpec::Core::Formatters::ProgressFormatter | |
| RSpec::Core::Formatters.register self, :example_started, :example_passed, :example_pending, :example_failed, :start_dump | |
| def initialize(output) | |
| @output = output | |
| @files_processed = {} | |
| end | |
| def example_started(notification) | |
| return if @files_processed.key?(notification.example.file_path) |
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 "io/console" | |
| LINE_START = " * [pruned] origin/" | |
| def error(message, error_code=-1) | |
| STDERR.puts message | |
| exit(error_code) | |
| 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
| // ==UserScript== | |
| // @name Zoho Estimate Plugin | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description Add button for converting Zoho estimates to purchase and sales orders. | |
| // @author You | |
| // @include https://books.zoho.eu/app | |
| // @grant GM_log | |
| // ==/UserScript== |
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
| typedef Vec3 (*GjkSupportFunc)(Vec3 searchDirection, void* shape1, void* shape2); | |
| struct Simplex { | |
| Vec3 b, c, d; // a is always the latest point added, as the others get pushed down the stack. | |
| int pointCount; | |
| Vec3 searchDirection; | |
| }; | |
| local_function Vec3 crossSelf(Vec3 a, Vec3 b) { |