1.0 == 1 # true
1.0.eql? 1 # false
1.0 === 1 # 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
| ;;; request-bin.el --- Create a RequestBin on http://requestb.in/ | |
| ;; Author: Skye Shaw <skye.shaw@gmail.com> | |
| ;; Version: 0.0.1 | |
| ;; Keywords: tools | |
| ;; URL: https://gist.github.com/19d1e0d85eadd555c178ae1754cc6211 | |
| ;; This file is NOT part of GNU Emacs. | |
| ;;; License: |
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 'get_process_mem' | |
| require 'rusage' # gem install rusage | |
| require 'benchmark' | |
| n = 2000 | |
| gpm = GetProcessMem.new | |
| Benchmark.bm(10) do |x| | |
| x.report("status:") { n.times do gpm.linux_status_memory end } | |
| # In sshaw version |
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
| # Batch update the GitHub user or organization in all repo remotes under the given directory. | |
| # Does not work with JRuby. | |
| # | |
| # usage: usage: gh_update_remotes_owner dir oldorg neworg | |
| gh_update_remotes_owner() | |
| { | |
| if [ $# -lt 3 ]; then | |
| echo "usage: gh_update_remotes_owner dir oldorg neworg" >&2 | |
| return 1 | |
| fi |
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
| Gem::Specification.new do |s| | |
| s.name = "gender_api" | |
| s.version = "0.0.1" | |
| s.date = "2016-03-05" | |
| s.summary = "API client for the Gender API" | |
| s.description = "API client for the gender detection service Gender API: https://gender-api.com/en/api-docs" | |
| s.authors = ["Skye Shaw"] | |
| s.email = "skye.shaw@gmail.com" | |
| s.files = Dir["*.rb"] | |
| s.require_paths = ["."] |
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 "shopify_api" | |
| # | |
| # Retry a ShopifyAPI request if an HTTP 429 (too many requests) is returned. | |
| # | |
| # ShopifyAPIRetry.retry { customer.update_attribute(:tags, "foo") } | |
| # ShopifyAPIRetry.retry(30) { customer.update_attribute(:tags, "foo") } | |
| # c = ShopifyAPIRetry.retry { ShopifyAPI::Customer.find(id) } | |
| # | |
| # By Skye Shaw (https://gist.github.com/sshaw/6043fa838e1cecf9d902) |
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::Checksum::Matchers Check if a String looks like a checksum produced by the given algorithm. | |
| # https://gist.github.com/sshaw/df14f6f89860b2dbcfd2 | |
| # | |
| # Copyright (c) 2016 Skye Shaw. Released under the MIT License (https://opensource.org/licenses/MIT) | |
| # | |
| require "rspec/expectations" | |
| RSpec::Matchers.define :be_a_checksum do | |
| regex = /\A[0-9a-f]{32,128}\z/i | |
| chars = { |
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 | |
| # | |
| # Export Chrome search engine shortcuts to emacs' engine-mode (https://github.com/hrs/engine-mode) | |
| # https://gist.github.com/sshaw/9b635eabde582ebec442a | |
| # | |
| sql="select short_name,keyword,url from keywords where length(keyword) < 3" | |
| source=${1:-$HOME/Library/Application Support/Google/Chrome/Default/Web Data} |
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
| Gem::Specification.new do |s| | |
| s.name = "bh-flash" | |
| s.version = "0.0.2" | |
| s.date = "2015-08-02" | |
| s.summary = "Render flash messages using Bootstrap Helpers" | |
| s.description =<<-DESC | |
| Render flash messages using Bootstrap Helpers: http://fullscreen.github.io/bh/ | |
| Inspired by: https://github.com/planetargon/flash-message-conductor | |
| DESC | |
| s.authors = ["Skye Shaw"] |
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 "gdbm" | |
| require "sucker_punch" | |
| class IdBasedJob | |
| include SuckerPunch::Job | |
| def perform(db, ids) | |
| ids.each do |id| | |
| SuckerPunch.logger.info(sprintf "Running %s [%d]\n", id, Thread.current.object_id) | |
| if do_some_thang |