Skip to content

Instantly share code, notes, and snippets.

Avatar
😅
I may be slow to respond.

Nick Charlton nickcharlton

😅
I may be slow to respond.
View GitHub Profile
@nickcharlton
nickcharlton / content.md
Last active May 28, 2021
Gist from Drafts
View content.md

Debugging capybara-table

Bumping Nokogiri to 1.11.5, caused our tests around HTML tables to start failing with ERROR: Recursion limit exceeded. The change that caused this is in commit [#9fcb7d][1] (see also: [the full set of changes][2]), where the recursion limit is restricted to 500 (see: [libxml2 commit][3]), which is how it started happening with this Nokogiri update.

In investigating what was causing this to recur, it seems like we don't need all of capybara-table, as [enough is already included in Capybara itself][4].

I did consider just dropping the dependency, but the Matcher/Renderer classes are key to the usability of our tests — I even tried not using them but trying to factor out the dependency was a horrible experience.

My next step would be to try and switch the Capybara selector that CapybaraTable::RspecMatchers uses to the ones already in Capybara: [table.rb][5] and [table_row.rb][6]. This might be as simple as vendering the RspecMatchers.rb file into the project and seein

View content.md

Drafts → Basecamp / Trix Rich Text Fields

Problem: Copying text with reference links as Rich Text from Drafts into Basecamp mangles all of the formatting.

Solution:

  1. Inspect Element on the editor
  2. $1.editor.setSelectedRange([0, 0])
  3. Copy as HTML in Drafts
  4. $1.editor.insertHTML(

    Daily Update

    )
@nickcharlton
nickcharlton / how-basecamp-uses-basecamp.md
Created Apr 3, 2020
How Basecamp uses Basecamp Notes
View how-basecamp-uses-basecamp.md

How Basecamp uses Basecamp

Recording: https://www.twitch.tv/videos/574380757

  • Points out that nothing has changed with them now WFH; they've always worked this way,
  • HQ is equivalent of a company intranet: docs, files, discussions, etc. Every one has access,
  • Teams are like departments or groups: distinct workspaces for the given team, admin gets to choose who sees what; unless you're added they're hidden,
  • Everything is "commentable": you can discuss things in context on every item,
  • DHH points out that they come back to these; sometimes two years later, giving the example of a an AB test,
  • Everything item exists under a URL; it's always referencable,
@nickcharlton
nickcharlton / Gemfile
Created May 9, 2019
Alexa Endpoint Demo
View Gemfile
source "https://rubygems.org"
gem "sinatra"
View vagrant_landrush_debug_output.txt
[Desktop/landrush-example]% VAGRANT_LOG=debug vagrant up
INFO global: Vagrant version: 2.2.0
INFO global: Ruby version: 2.4.4
INFO global: RubyGems version: 2.6.14.1
INFO global: VAGRANT_DEFAULT_PROVIDER="vmware_fusion"
INFO global: VAGRANT_VMWARE_CLONE_DIRECTORY="/Users/nickcharlton/.vagrant.d/clones"
INFO global: VAGRANT_LOG="debug"
INFO global: VAGRANT_INSTALLER_ENV="1"
INFO global: VAGRANT_EXECUTABLE="/opt/vagrant/embedded/gems/2.2.0/gems/vagrant-2.2.0/bin/vagrant"
INFO global: VAGRANT_INSTALLER_VERSION="2"
@nickcharlton
nickcharlton / swagger.yml
Created Oct 2, 2018
A cut down version of the main Swagger example.
View swagger.yml
---
swagger: "2.0"
info:
description: "This is a sample server Petstore server."
version: "1.0.0"
title: "Swagger Petstore"
termsOfService: "http://swagger.io/terms/"
contact:
email: "apiteam@swagger.io"
license:
View keybase.md

Keybase proof

I hereby claim:

  • I am nickcharlton on github.
  • I am nickcharlton (https://keybase.io/nickcharlton) on keybase.
  • I have a public key ASAFoqwDxAc1JTlEzlbe4JdIcxHM00T-YKGtyclZW-kWfAo

To claim this, I am signing this object:

@nickcharlton
nickcharlton / gist:05d7cd0828b2e786571fa5110abe0adb
Last active Aug 11, 2018
sassc-rails administrate Review App Build Log
View gist:05d7cd0828b2e786571fa5110abe0adb
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.4.4
-----> Installing dependencies using bundler 1.15.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.3). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Fetching rake 12.3.0
@nickcharlton
nickcharlton / blocking-request.js
Created Apr 19, 2018
Node: Synchronous/Blocking HTTP Request
View blocking-request.js
// In the rare case you actually want a syncronous request
// this will wait until the data arrives before continuing
// down the file.
//
// The service where this is used fetches configuration data
// from an external service in order to run.
const axios = require('axios')
let done = false
@nickcharlton
nickcharlton / validate_method.rb
Created Mar 16, 2018
Validate attributes have a value
View validate_method.rb
class Resource
def validate
missing = self.class.required_attributes[self.class.name].select do |key|
instance_variable_get("@#{key}").nil?
end
if missing.any?
raise StandardError, "Missing attributes: #{missing.join(', ')}"
end
end