Skip to content

Instantly share code, notes, and snippets.

@xaviershay
xaviershay / github_requests.md
Last active July 8, 2024 15:14
Pull request feature requests

Hello Github,

Pull requests are not serving me well on large reviews. Here are some problems and suggested enhancements that would make me happy.

  • Mark comment as "resolved" (see google docs for an example). As code changes, comments get lost or made redundant, and it is not clear (to either the author or reviewers) which are still relevant and which have been addressed. Resolving a comment doesn't need to make it dissappear, but I need to be able to see "which comments have not been addressed" somehow. This feature would be the most useful to me.
  • Reply to a comment. This can be done in effect on line comments (assuming there is only one), but cannot on PR comments. Particularly with many threads, the lack of this makes a review hard to follow.
  • Explicit "approve/block" life cycle. The block is actually more important to me ... often on a PR that has been incrementally improved I want to "block" final merge of it until I get a chance to rebase/squash and generally pretty it up. The block can be over
package com.atlassian.stash.plugin.webook;
import com.atlassian.stash.event.pull.PullRequestRescopedEvent;
import com.atlassian.stash.hook.repository.AsyncPostReceiveRepositoryHook;
import com.atlassian.stash.hook.repository.RepositoryHookContext;
import com.atlassian.stash.nav.NavBuilder;
import com.atlassian.stash.pull.PullRequestRef;
import com.atlassian.stash.repository.RefChange;
import com.atlassian.stash.repository.RefChangeType;
import com.atlassian.stash.repository.Repository;
@xaviershay
xaviershay / migration_sql.rb
Created August 14, 2015 21:21
Get SQL output from a Rails migration
#!/usr/bin/env ruby
require_relative 'config/environment'
path = ARGV.shift || raise("specify migration as first argument")
require_relative path
filename = File.basename(path, ".rb")
timestamp, name = filename.split("_", 2)
@xaviershay
xaviershay / gccc.md
Last active August 28, 2022 00:17
Request for services - Geelong Cross Country Club Handicapping System

Request for services - Geelong Cross Country Club Handicapping System

Context

The Geelong Cross Country Club (an established non-profit running group) uses a rails application to manage race results and handicaps for members. It was written by me in 2014 and has seen sporadic maintenance and features since. The codebase is relatively standard rails running against postgres on heroku. GCCC have requested some changes that I am unable to get to in a timely manner, so they are looking to engage a (paid) contractor. The app is also due for a round of upgrades.

@xaviershay
xaviershay / app.rb
Created November 24, 2011 19:14
Simple rack app with routing. Is this possible with http_router?
require 'rack/request'
require 'rack/response'
class App
attr_accessor :provider
# This constructor DI is not possible in Sinatra(?), since the framework
# creates the new instance for you.
def initialize(provider)
@provider = provider
@xaviershay
xaviershay / check-for-fixes.rb
Created July 24, 2021 23:20
Script to find issues referenced in a repo and check whether they're fixed or not
#!/usr/bin/env ruby
require 'tmpdir'
require 'net/http'
require 'openssl'
require 'uri'
require 'json'
require 'date'
def file_cache(key)
@xaviershay
xaviershay / spec.json
Last active October 9, 2020 04:27
contribution-vs-interest
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"description": "Plots two functions using a generated sequence.",
"width": 600,
"height": 300,
"title": "Figure out what monthly contribution is equivalent to what savings rate",
"data": [{
"name": "month",
"values": [
@xaviershay
xaviershay / spec.json
Created October 9, 2020 00:10
interest-exploration
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"description": "Plots two functions using a generated sequence.",
"width": 600,
"height": 300,
"data": [{
"name": "month",
"values": [
],
@xaviershay
xaviershay / repro-1489.sh
Last active July 25, 2020 22:27
Sample repro script for bundler issues
#!/bin/bash
set -ex
mkdir -p /tmp/repro-1489
cd /tmp/repro-1489
bundle env
# Bundler 1.3.5
# Ruby 2.0.0 (2013-06-27 patchlevel 247) [x86_64-darwin12.4.0]
@xaviershay
xaviershay / transform_hash.rb
Created December 4, 2011 22:56
Ruby puzzle
describe '#transform_hash' do
it 'transforms a single entry hash' do
transform_hash(a: [1, 0]).should == [[1], [0]]
end
it 'transforms a double entry hash' do
transform_hash(a: [1, 0], b: [0, 1]).should == [[1, 0], [0, 1]]
end
it 'transforms a multiple entry hash' do