Skip to content

Instantly share code, notes, and snippets.

Bill Burcham Bill

Block or report user

Report or block Bill

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:95507
# the approved way to add methods to example groups in rspec
# from David Chelimsky's comment here http://www.benmabey.com/2008/06/08/writing-macros-in-rspec/
Spec::Runner.configure do |config|
config.include(AssignMacro, :type => :controllers)
end
View gist:96776
# capture a yaml dump of an object like this:
# capture { y request }
module Kernel
def capture # pass a block to capture
old_stdout = $stdout
out = StringIO.new
$stdout = out
begin
yield
ensure
View application_controller.rb
before_filter :set_database_for_cluster_stuff
# SourceSpecific and subclasses (Content, Cluster) take up a lot of space so we want them in
# their own per-Domain databases. This hook injects the appropriate database connection based
# on the Domain gleaned from the request so subsequent access (during this request)
# will go to the appropriate database.
def set_database_for_cluster_stuff
config = ActiveRecord::Base.configurations[RAILS_ENV]
# Get the database name from the Domain
View morse_regexp.rb
require 'singleton'
# This is a parser pattern based on regexp as lexer.
# Express your tokens as parenthesized regexps separated by
# alternation (|). Erroneous input causes immediate return.
module Parse
def parse( s, p, &block)
i = 0
while i < s.length do
# could pass i to match and use block form in newer lib
View morse_fsa.rb
require 'singleton'
# This is a parser pattern based on regexp as lexer.
# Express your tokens as parenthesized regexps separated by
# alternation (|). Erroneous input causes immediate return.
module Parse
def parse( s, p, &block)
i = 0
while i < s.length do
@Bill
Bill / part1.clj
Last active Mar 3, 2017
Clojure Collection Processing In Context: Part I: Eager to Process
View part1.clj
;
; Clojure Collection Processing In Context: Part I: Eager to Process
; © 2017, by Bill Burcham
;
; Slides at: https://docs.google.com/presentation/d/1wKcTN5-f00ZCKk_LpUG5GIorh89AImmuxvG7MiGiF1c
;
(ns ccpic.part1)
(use 'clojure.repl)
@Bill
Bill / FutureTest.java
Created Oct 17, 2018
Java Future Test
View FutureTest.java
import org.junit.Before;
import org.junit.Test;
import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
public class FutureTest {
@Bill
Bill / MonitorQueryUnderContentionBenchmark.java
Last active Oct 30, 2018
This benchmark works against the latest Apache Geode develop branch
View MonitorQueryUnderContentionBenchmark.java
/*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional information regarding
* copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License. You may obtain a
* copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
@Bill
Bill / Foo.kt
Created Jan 10, 2019
Little dispatcher exerciser
View Foo.kt
import kotlinx.coroutines.*
import kotlinx.coroutines.launch;
import kotlinx.coroutines.scheduling.ExperimentalCoroutineDispatcher
import kotlinx.coroutines.test.setMain
import java.util.concurrent.TimeUnit
import kotlin.coroutines.coroutineContext
suspend fun log(msg: String) = println("[${Thread.currentThread().name} ${coroutineContext[CoroutineName]}] $msg")
fun main(args: Array<String>) = repeat(1) {
@Bill
Bill / haregionqueue.png
Last active Apr 3, 2019
Geode HARegionQueue Class Diagram
You can’t perform that action at this time.