Skip to content

Instantly share code, notes, and snippets.

View whatcould's full-sized avatar

David Reese whatcould

  • Bust Out Solutions
  • philly
View GitHub Profile
@whatcould
whatcould / current_zone_memory
Created January 19, 2009 19:39
munin plugin to track memory on solaris zone (joyent accelerator)
#!/usr/bin/env ruby
def output_config
puts <<-END
graph_category System
graph_title accelerator memory
graph_vlabel M
rss.label rss
swap.label swap
@whatcould
whatcould / gist:5a7c6c28e757544744e4
Last active August 29, 2015 14:27 — forked from heijmerikx/gist:1261118
MySQL FIND_IN_SET to Postgresql...
def self.order(ids)
# The postgresql way
update_all(["position = STRPOS(?, ','||id||',')", ",#{ids.join(',')},"])
# the mysql way
# update_all(['position = FIND_IN_SET(id, ?)', ids.join(',')])
end
@whatcould
whatcould / albers.html
Last active August 29, 2015 14:14 — forked from minikomi/albers.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Albers Projection</title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/2.8.1/d3.v2.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<style type="text/css">
@whatcould
whatcould / analytics.rb
Last active August 29, 2015 14:07 — forked from joshuaclayton/README.md
RSpec custom matchers for Segment.io tracking
RSpec::Matchers.define :have_tracked do |event_name|
match do |backend|
@event_name = event_name
@backend = backend
if @match_user && @properties
backend.tracked_events_for(@match_user).named(@event_name).has_properties?(@properties)
elsif @properties
backend.tracked_events.named(@event_name).has_properties?(@properties)
elsif @match_user
backend.tracked_events_for(@match_user).named(@event_name).events.any?