Skip to content

Instantly share code, notes, and snippets.

View mattyoho's full-sized avatar

Matt Yoho mattyoho

  • San Francisco, CA, USA
View GitHub Profile
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb
index 2955ead3bb..01467628d8 100644
--- a/activerecord/lib/active_record/relation/query_methods.rb
+++ b/activerecord/lib/active_record/relation/query_methods.rb
@@ -348,7 +348,7 @@ def reorder!(*args) # :nodoc:
self
end
- VALID_UNSCOPING_VALUES = Set.new([:where, :select, :group, :order, :lock,
+ VALID_UNSCOPING_VALUES = Set.new([:where, :select, :group, :order, :lock, :optimizer_hints,
@rtfb
rtfb / main.go
Created July 28, 2017 19:36
A complete example of a custom Blackfriday v2 renderer with pygmentizing CodeBlock handler
package main
import (
"fmt"
"io"
"os/exec"
bf "gopkg.in/russross/blackfriday.v2"
)
@spicycode
spicycode / .tigrc
Last active November 26, 2018 12:56
my tigrc
# vim: set expandtab sw=4 tabstop=4:
# *color* 'area' 'fgcolor' 'bgcolor' '[attributes]'
# general
color default 15 235
color cursor 15 241
color title-focus 242 221
color title-blur 242 221
color delimiter 213 default
color author 156 default
Thread #0 was switched to 125044 times
Thread #1 was switched to 124994 times
Thread #2 was switched to 124994 times
Thread #3 was switched to 124993 times
Thread #4 was switched to 124993 times
Thread #5 was switched to 124994 times
Thread #6 was switched to 124994 times
Thread #7 was switched to 124993 times
1,000,000 thread switches took 2.143874 seconds
@atmos
atmos / heaven.md
Last active November 23, 2020 22:35
Response to a dude who asked about heaven. https://github.com/holman/feedback/issues/422

@holman got a request about our deployment system, heaven

I know it's not a high priority, but has there been any activity on open-sourcing the core Heaven gem?

There is. I've been working on extracting the non-GitHub specific parts into two gems. This first is a CLI portion called hades. The second is an HTTP API portion called heaven.

When you open source something previously used as in internal tool like Heaven, Hubot, Boxen, etc., how do you manage and hook in the parts that need to stay internal?

Normally I focus around four questions:

@piki
piki / mmap.c
Created May 7, 2013 15:53
some fun with mmap and madvise
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#define CHECK(thing) if (!(thing)) { perror(#thing); exit(1); }
#define MAX_PAGE_IN 104857600
@addyosmani
addyosmani / headless.md
Last active May 17, 2024 03:38
So, you want to run Chrome headless.

Update May 2017

Eric Bidelman has documented some of the common workflows possible with headless Chrome over in https://developers.google.com/web/updates/2017/04/headless-chrome.

Update

If you're looking at this in 2016 and beyond, I strongly recommend investigating real headless Chrome: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md

Windows and Mac users might find using Justin Ribeiro's Docker setup useful here while full support for these platforms is being worked out.

@jimweirich
jimweirich / nav_option_demo_snippet.rb
Created March 6, 2013 22:16
Some unusual Ruby code I've been working on today.
class NavOptionDemo < NavOption
include CFields
uint32_t :ctrl_state # Flying state (landed, flying,
# hovering, etc.) defined in
# CTRL_STATES enum.
uint32_t :vbat_flying_percentage # battery voltage filtered (mV)
alias :battery_level :vbat_flying_percentage
float32_t :theta # UAV's pitch in milli-degrees
@tenderlove
tenderlove / omg.markdown
Created February 12, 2013 03:37
class_eval vs define_method memory usage
N = ARGV[0].to_i
T = ARGV[1] || 'eval'

class Foo
  if T == 'eval'
    N.times do |i|
      class_eval "def hello_#{i}; end"
    end
 else
@freeformz
freeformz / WhyILikeGo.md
Last active October 6, 2022 23:31
Why I Like Go

A slightly updated version of this doc is here on my website.

Why I Like Go

I visited with PagerDuty yesterday for a little Friday beer and pizza. While there I got started talking about Go. I was asked by Alex, their CEO, why I liked it. Several other people have asked me the same question recently, so I figured it was worth posting.

Goroutines

The first 1/2 of Go's concurrency story. Lightweight, concurrent function execution. You can spawn tons of these if needed and the Go runtime multiplexes them onto the configured number of CPUs/Threads as needed. They start with a super small stack that can grow (and shrink) via dynamic allocation (and freeing). They are as simple as go f(x), where f() is a function.