Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am holtonma on github.
  • I am holtonma (https://keybase.io/holtonma) on keybase.
  • I have a public key ASDEaZ8alxMTPzywiRa2loxruRCVQ1DjmvWGd8RZsqKq6Ao

To claim this, I am signing this object:

@holtonma
holtonma / issues_building_native_extensions
Created March 1, 2016 05:55 — forked from pghotra/issues_building_native_extensions
Installing gems with native extensions on mac osx 10.9.1 (mavericks), with rvm and ruby 2.0
PROBLEM: "Unable to install Redcloth"
ENVIRONMENT: rvm, ruby-2.0.0-p353, osx 10.9.1, gcc -> 'Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
FIX:
1. remove ruby: rvm remove ruby-2.0.0-p353
2. install ruby using 'with-gcc' flag: rvm install ruby-2.0.0-p353 --with-gcc=clang
Running bundle install again:
* progress - Redcloth installed
* but...nokogiri failed
[mholton@mh:~/Go/src/github.com/holtonma/gocb → fix_golint_exported_methods]$ golint
bucket.go:10:1: comment on exported type Bucket should be of the form "Bucket ..." (with optional leading article)
bucket.go:54:1: exported method Bucket.OperationTimeout should have comment or be unexported
bucket.go:57:1: exported method Bucket.SetOperationTimeout should have comment or be unexported
bucket.go:60:1: exported method Bucket.DurabilityTimeout should have comment or be unexported
bucket.go:63:1: exported method Bucket.SetDurabilityTimeout should have comment or be unexported
bucket.go:66:1: exported method Bucket.DurabilityPollTimeout should have comment or be unexported
bucket.go:69:1: exported method Bucket.SetDurabilityPollTimeout should have comment or be unexported
bucket.go:73:1: exported method Bucket.SetTranscoder should have comment or be unexported
bucket.go:77:1: exported method Bucket.InvalidateQueryCache should have comment or be unexported
@holtonma
holtonma / dd.log
Created November 19, 2015 20:52 — forked from ktheory/dd.log
EC2 EBS-SSD vs instance-store performance on an EBS-optimized m3.2xlarge
# /tmp/test = EBS-SSD
# /mnt/test = instance-store
root@ip-10-0-2-6:~# dd bs=1M count=256 if=/dev/zero of=/tmp/test
256+0 records in
256+0 records out
268435456 bytes (268 MB) copied, 3.26957 s, 82.1 MB/s
root@ip-10-0-2-6:~# dd bs=1M count=256 if=/dev/zero of=/tmp/test
256+0 records in
256+0 records out
# ensure single connection to Couchbase bucket
# http://docs.couchbase.com/developer/java-2.0/managing-connections.html
class Resources
include Singleton
attr_accessor :cluster, :bucket
def init_couchbase(config)
@cluster = Couchbase::Cluster.new(config['node_list'])
@bucket = cluster.open_bucket("#{config['bucket']}", "#{config['password']}")
module Desk::Search::Es::Reports
class TicketsByStatus
attr_reader :site_id, :hours_ago
def initialize(options = {})
@time_ago = options[:hours_ago] || 6
@site_id = options[:site_id]
# enum on ticket_status_type_id
curl -XGET 'http://localhost:9200/ticket_customer_1/ticket_customer/_search?search_type=count&pretty=true' -d '
{
"query" : {
"range" : {"created_at" : { "gte" : 0}}
},
"facets" : {
"new" : {
"date_histogram" : {
"field" : "created_at",
"interval" : "hour",
def a_b_shared(list_a, list_b)
only_a = []
only_b = []
shared = []
list_a.each do |x|
if list_b.include?(x) == nil
only_a << x
elsif list_b.include?(x)
shared << x
b_index = list_b.index(x)
@holtonma
holtonma / gist:742955
Created December 16, 2010 02:48
markup in the page, and the JS call to initialize infiniScroll
<!DOCTYPE html>
<html>
<head>
<title>Mark Holton | Web Application Development</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src="/javascripts/jquery-1.4.4.min.js" type="text/javascript"></script>
<script src="/javascripts/infiniScroll.js" type="text/javascript"></script>
<link href="/stylesheets/style.css" media="screen" rel="stylesheet" type="text/css" />
@holtonma
holtonma / _grab_next.html.erb
Created December 16, 2010 02:38
example partial that will be returned from server...
<% @posts.each do |post| %>
<div class="headline post" id="post_<%= post.id %>">
<h3><%= link_to post.title, post_path(post.to_param) %></h3>
<div class="comment">
<a href="/posts/<%= post.to_param %>" title="<%= post.title %>"><%= post.comments.length %></a>
</div>
<div class="date"><%= distance_of_time_in_words(post.created_at, Time.now) %> ago</div>
</div> <!--/ .headline -->
<% end %>