Skip to content

Instantly share code, notes, and snippets.

Kyle Tolle kyletolle

Block or report user

Report or block kyletolle

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:9939366
# Code to profile...
result = RubyProf.stop
# Print a graph to an HTML file, sorted by time spend in children.'profile_output.html', 'w') do |file|
printer = result
printer.print(file, sort_method: :children_time)
View gist:625742da4ec0a64584ed
irb(main):002:0> require 'bigdecimal'
=> true
irb(main):003:0> v = BigDecimal("7.1762")
=> #<BigDecimal:7f8905213dc0,'0.71762E1',18(18)>
irb(main):004:0> v.truncate(2).to_s('F')
=> "7.17"
irb(main):005:0> w = BigDecimal("4.2")
=> #<BigDecimal:7f890522c5f0,'0.42E1',18(18)>
irb(main):006:0> w.truncate(2).to_s('F')
=> "4.2"
mikepack / 1_inheritance.rb
Last active Aug 29, 2015
5 Composition Techniques
View 1_inheritance.rb
class Animal
def run
puts 'running'
end #=> running
class Wolf < Animal
def follow_pack
searls / gist:a644a89017022912b2c6
Last active Aug 29, 2015
Some thoughts on small teams and headquarters HQs
View gist:a644a89017022912b2c6

This is a simple little note I wrote down when talking to another company owner on the topic of moving a fully distributed team (with some folks in the same city) to a mostly-distributed team with an HQ office in a single city. It's not necessarily useful as general advice beyond that

why thoughtful physical location matters

I often advise clients that are actively focused on improving their teams to either embrace a fully-distributed team or a fully-colocated one, and to avoid other permutations of organization. Patterns that I see a lot:

  • small satellite offices off a large HQ
  • a handful of remote folk off a large HQ
  • n similarly-sized engineering offices
View a_terrible_thing.txt
[aaron@TC omglolwut (master)]$ cat lib/tasks/disable_autoload_during_migrations.rake
task :disable_autoload do
ActiveSupport::Dependencies.class_eval do
extend {
def load_file(path, const_paths = loadable_constants_for_path(path))
return if path.starts_with? File.join(Rails.application.root, 'app', 'models')
View Markdown image captions
## _includes/image.html
<div class="image-wrapper" >
{% if include.url %}
<a href="{{ include.url }}" title="{{ include.title }}" target="_blank">
{% endif %}
<img src="{{ site.url }}/{{ include.img }}" alt="{{ include.title }}"/>
{% if include.url %}
{% endif %}
{% if include.caption %}
otaviomedeiros / alias_matcher.rb
Created Mar 1, 2012
RSpec matcher for alias_method
View alias_matcher.rb
# RSpec matcher for alias_method.
# Usage:
# describe User do
# it { should alias_from(:username).to(:email) }
# end
RSpec::Matchers.define :alias_from do |alias_method|
satlavida /
Created Feb 5, 2012
Nested classes in CoffeeScript
class AlertMyFriends
class AlertMyFriends::Show
constructor: ->
alert "Hello Friends"
amf = new AlertMyFriends
al = new amf.Show()
infotroph / pandoc-word-sectionbreak.hs
Last active Jun 6, 2018
Pandoc filter: convert horizontal rules into section breaks for Word output
View pandoc-word-sectionbreak.hs
#!/usr/bin/env runhaskell
Pandoc filter to replace horizontal rules with hard section breaks when output is in Word format.
Credits: This is a very lightly adapted version of a `\newpage` filter
previously described on pandoc-discuss:!topic/pandoc-discuss/FzLrhk0vVbU
krisbulman / countCSSRules.js
Last active Feb 6, 2019 — forked from psebborn/countCSSRules.js
Count the number of rules and selectors for CSS files on the page. Flags up the >4096 threshold that confuses IE. — This snippet has been modified to count more than just the first level of CSSStyleRule objects within CSSMediaRule.
View countCSSRules.js
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
for (var i = 0; i < document.styleSheets.length; i++) {
function countSheet(sheet) {
You can’t perform that action at this time.