Skip to content

Instantly share code, notes, and snippets.

View rylwin's full-sized avatar

Ryan Winograd rylwin

View GitHub Profile
@rylwin
rylwin / sentry-fetch-issue-events
Created November 23, 2022 14:17
Fetch events for a given Sentry issue
#!/usr/bin/env bash
set -euo pipefail
USAGE="Usage: $(basename "$0") ISSUE_ID
Fetches all events for an issue, page by page.
At any time you feel you've retrieved enough events, use CTRL-C to stop
fetching.
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# Activate the gem you are reporting the issue against.
gem "activerecord", "~> 7.0.0"
gem "sqlite3"
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "caxlsx"
gem "benchmark"
end
require "axlsx"
$ ./src/curl -v -D - --max-time 240 --output /dev/null --silent --show-error --stderr - --write-out 'Timings: NL%{time_namelookup} C%{time_connect} AC%{time_appconnect} PT%{time_pretransfer} R%{time_redirect} ST%{time_starttransfer} TT%{time_total}\n' 'https://mypdfresume.com/'
* STATE: INIT => CONNECT handle 0x55cf974c8f98; line 1418 (connection #-5000)
* Added connection 0. The cache now contains 1 members
* Trying 45.55.23.92...
* TCP_NODELAY set
* STATE: CONNECT => WAITCONNECT handle 0x55cf974c8f98; line 1470 (connection #0)
* Connected to mypdfresume.com (45.55.23.92) port 443 (#0)
* STATE: WAITCONNECT => SENDPROTOCONNECT handle 0x55cf974c8f98; line 1587 (connection #0)
* Marked for [keep alive]: HTTP default
@rylwin
rylwin / results.txt
Created December 12, 2013 22:06
Compare '+' vs '\' for multiline string concatenation in Ruby
Running with n of 1000000
user system total real
slash: 0.170000 0.010000 0.180000 ( 0.164066)
plus: 0.430000 0.000000 0.430000 ( 0.439272)
interpolate: 0.170000 0.000000 0.170000 ( 0.161643)
@rylwin
rylwin / export_features.rb
Created August 14, 2013 01:52
Output cucumber features as HTML
require 'lib/gherkin_html_formatter'
require 'gherkin/parser/parser'
require 'stringio'
require 'multi_json'
# This example reads a couple of features and outputs them as JSON.
io = StringIO.new
formatter = Gherkin::Formatter::HtmlFormatter.new(io, true)
parser = Gherkin::Parser::Parser.new(formatter)
module UIHelper
def box(title=nil, opts={}, &block)
title = "<h4>#{title}</h4>".html_safe if title
body = content_tag(:span, with_output_buffer(&block), :class => 'content')
box_class = @management ? 'well' : 'box'
opts[:class] = "#{box_class} #{opts[:class]}".squish
content_tag(:div, title + body, opts).html_safe
@rylwin
rylwin / calendar_input.rb
Created December 5, 2011 16:19
Rails 3: calendar_date_select + formtastic (2.0.2)
class CalendarInput < Formtastic::Inputs::StringInput
def to_html
input_wrapping do
label_html <<
builder.text_field(method, input_html_options)
end
end
end
@rylwin
rylwin / heroku.rake
Created June 10, 2010 19:45
Rake task to generate heroku .gems file from gems listed in environment.rb
namespace :heroku do
desc "Update .gems with a list of the required gems"
task :gems => 'gems:base' do
gem_lines = []
gem_array = Rails.configuration.gems.reject{|g| g.frozen? && !g.framework_gem?}.map do |gem|
line = gem.name
line += " --source #{gem.source}" if gem.source
line += " --version '#{gem.requirement.to_s}'" if gem.requirement
gem_lines << line