Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View schneems's full-sized avatar

Richard Schneeman schneems

View GitHub Profile
gem install rails
rails new foo
cd foo
rails generate controller welcome
cat <<EOT >> app/views/welcome/index.html.erb
<h2>Hello World</h2>
<p>
The time is now: <%= Time.now %>
</p>

I have monitoring set up via Heroku on memory/response times/etc. So if something major happened, I would find out about it pretty quickly.

Other than that, I just attack things that are slow. If a thing gets reintroduced that is slow and if it shows up in my metrics, then I attack it. Otherwise if it's not the slowest thing, I don't focus on it.

A general awareness of best practices and code reviews can help prevent slow things from going back into the codebase.

Writing notes about why you did perf changes might help, but it's a double edge sword. I replaced lots of things in sprockets that had a comment like "did this because it's faster". Maybe if you do leave a note like that, link to a benchmark so future employees can see if it's still the fastest, or see what other things were tried.

one way to check to see if absolute paths are being used in the cache on different machines is to figure out the current path

$ pwd

Then grep for things with that absolute path in it:

~ $ grep -R "$(pwd)" tmp/cache

I wanted an easy way to compare semver based strings without any fancy c-extensions in postgres:

=> select '1.0.1'::semverish >= '1.0.0';
 ?column?
----------
 t

Having no idea how to do this. I was told I can make a custom "domain", this is a datatype that verifies the format

This written in response to http://bit.ly/2dJEXSW. While your test suite might look like the provided pyramid based on number of tests, I think it accidentally sends the wrong impression that unit tests are the most valuable in your codebase. I disagree.

At Gowalla we had a developer obsessed with unit tests. At the time unit tests were in vouge and they meant fast, integration tests meant slow. So they spent a ton of time writing them.

This caused two problems. Having enough unit tests to cover everything that would be exerciesed in an integration test meant a HUGE amount of unit tests. This caused the suite to be very brittle. Trivial changes would break the test suite, and things that would break the site, would not break the test suite. Once we had our signup page broken for 3 days and no one realized because it wasn't tested. The second problem was the suite was SLOW, like really slow. So no one wrote new tests, no one ran the suite. It was a fight to get a CI server. We eventually threw away a larg

@schneems
schneems / command-line-only-objectspace-trace.sh
Last active December 19, 2022 13:54
trace where Ruby objects come from with this handy bash 3 liner
echo 'require "objspace"; ObjectSpace.trace_object_allocations_start; Kernel.send(:define_method, :sup) do |obj| ; puts "#{ ObjectSpace.allocation_sourcefile(obj) }:#{ ObjectSpace.allocation_sourceline(obj) }"; end' > tmp/tmp-gemfile
cat Gemfile >> tmp/tmp-gemfile
cat tmp/tmp-gemfile > Gemfile
# $ bundle exec irb
# irb(main):001:0> require 'rails'
# => true
# irb(main):002:0> sup(Rails)
# /Users/richardschneeman/.gem/ruby/2.4.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:3
########### THIS BENCH DOES NOT USE METHODS ###########
require 'benchmark/ips'
LONG_STRING = " this is a longer test
this is a longer test
this is a longer test
this is a longer test
this is a longer test"

@schneems This is a sponsored event ran by a company worth tens of millions of dollars, and it's mismanaged. Don't cry "community" at me.

I think you're assuming evil intentions when simple understaffing is at cause.

Money & Recognition

Code School started the Ruby Heroes, I can't speak on it's origins, i'm sure that it was intentionally intended to be a marketing tool. It's why companies sponsor things, it's why Heroku sponors RailsConf, A) We have a marketing message we want to get out B) We benifit from the community when the community is doing well, by sponsoring RubyCentral, we are putting some cash back into the community.

Code School pays for the custom awards that are handed out every year, they also pay for developer time to develop and organize the website, and for time to manage and promote the process. They also pay for travel and accomadations of the person attenging RailsConf to oversee the award process. Last year they also paid for hundreds of "Ruby Heroes" shirts to be handed out to

Everyday Heroes

Coding is "choose your own adventure" and today you're the Hero. In this talk we'll look at the powerful psychological blockers that prevent us from making the meaningful changes. We'll dig into historical experiments to unearth the secret motivators deep in the brain. You'll walk away with positive stories and actionable adivce on: how to persevere, take charge, and save the day. Cape not included.

Details

The focus will be about how to empower yourself to make meaningful change. We will talk about psychological concepts such as learned helplessness and diffusion of responsibility. We will look at psychological experiements for these traits and then work backwards to understand how they encourage us to be passive when it comes to the direction of our codebases, frameworks, and even communities.

Bundler could not find compatible versions for gem "sprockets":
In Gemfile:
sprockets (= 4.0.0.beta1)
sass-rails was resolved to 6.0.0, which depends on
sprockets (>= 4.0)
Could not find gem 'sprockets (>= 4.0)', which is required by gem 'sass-rails', in any of the sources.