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 'net/http' | |
| require 'uri' | |
| require 'json' | |
| # Example usage: | |
| # | |
| # PushoverApiClient.new.send_message( | |
| # title: "Error on website", | |
| # message: "Database connection failed", | |
| # priority: 1, # -2 lowest, -1 = low, 0 = normal, 1 = high (always generate sound and vibration), 2 = emergency (retried until acknowledged) |
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
| [alias] | |
| wip = for-each-ref --sort='authordate:iso8601' --format=' %(color:green)%(authordate:relative)%09%(color:white)%(refname:short)' refs/heads |
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').each(function(x, e) { $e = $(e); $e.replaceWith($('<span>').html($e.html()))});null |
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 | |
| lens = Array(ARGV[0]&.to_i || [20, 16, 10, 8, 6]) | |
| lo = 'qwertuiopasdfghjkxcvbnm'.split('') | |
| up = 'QWERTUPASDFGHJKLXCVBNM'.split('') | |
| nu = '123456789'.split('') | |
| si = '!@#$%^&*()-=+[]{};\'\\:"|,./<>?'.split('') | |
| lens.each do |len| |
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 | |
| # Remove all node_modules directories within a directory | |
| base_dir = File.expand_path(ARGV[0]) | |
| # Boilerplate from: http://stackoverflow.com/questions/1154846/continuously-read-from-stdout-of-external-process-in-ruby#answer-1162850 | |
| require 'pty' | |
| cmd = "find #{base_dir} -name node_modules" | |
| begin |
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 Person < Volt::Model | |
| field :first_name | |
| field :last_name | |
| field :full_name | |
| def initialize(*args) | |
| super | |
| -> { | |
| self.full_name = [first_name, last_name].compact.join(' ') | |
| }.watch! |
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 CapybaraExtras | |
| def browser | |
| Capybara.current_session.driver.browser | |
| end | |
| def response | |
| @response | |
| 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
| require 'active_support/core_ext' | |
| # Makes runnable classes available as methods. | |
| # | |
| # Example: | |
| # | |
| # class FirstClass | |
| # include RunnableClassesAsMethods | |
| # class AddNumbers | |
| # def initialize(a, b); @a, @b = a, b 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 | |
| require 'active_support/core_ext' | |
| a, b = ARGV | |
| NilClass.class_eval do | |
| def each_line | |
| 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
| def describe(&proc) | |
| Object.new.instance_eval(&proc) | |
| end | |
| proc = ->(*args){ | |
| puts "Proc called:" | |
| puts " self: #{self.inspect}" | |
| puts " args: #{args.inspect}" | |
| } |
NewerOlder