Skip to content

Instantly share code, notes, and snippets.

David Reese whatcould

  • Bust Out Solutions
  • philly
View GitHub Profile
@whatcould
whatcould / # qt5 - 2016-09-14_08-01-12.txt
Created Sep 14, 2016
qt5 on Mac OS X 10.12 - Homebrew build logs
View # qt5 - 2016-09-14_08-01-12.txt
Homebrew build logs for qt5 on Mac OS X 10.12
Build date: 2016-09-14 08:01:12
@whatcould
whatcould / gist:5a7c6c28e757544744e4
Last active Aug 29, 2015 — forked from heijmerikx/gist:1261118
MySQL FIND_IN_SET to Postgresql...
View gist:5a7c6c28e757544744e4
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
View 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 Aug 29, 2015 — forked from joshuaclayton/README.md
RSpec custom matchers for Segment.io tracking
View analytics.rb
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?
View tumblr-theme.html
<!DOCTYPE html>
<html>
<head>
<!--
Theme by inky.
Inspired by 'Minimalist', one of the default Tumblr themes.
-->
View chef_solo_bootstrap.sh
apt-get -y update
apt-get -y build-dep build-essential
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-dev libyaml-dev libffi-dev libxslt1-dev libxml2-dev
cd /tmp
curl -s -L http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p451.tar.gz | tar xzv
cd `ls | grep -m 1 ruby-`
./configure --prefix=/usr/local --disable-install-rdoc
make
make install
View performance_test_helper.rb
# See http://m.onkey.org/running-rails-performance-tests-on-real-data
# START : HAX HAX HAX
# Load Rails environment in 'test' mode
RAILS_ENV = "test"
require File.expand_path('../../config/environment', __FILE__)
# Re-establish db connection for 'performance' mode
silence_warnings { RAILS_ENV = "performance" }
ActiveRecord::Base.establish_connection
@whatcould
whatcould / liquid.js
Created Nov 9, 2009
Liquid-template language definition for codepress (http://codepress.sourceforge.net/)
View liquid.js
/*
* CodePress regular expressions for HTML syntax highlighting
*/
// HTML
Language.syntax = [
{ input : /(&lt;[^!]*?&gt;)/g, output : '<b>$1</b>' }, // all tags
{ input : /(&lt;a .*?&gt;|&lt;\/a&gt;)/g, output : '<a>$1</a>' }, // links
{ input : /(&lt;img .*?&gt;)/g, output : '<big>$1</big>' }, // images
{ input : /(&lt;\/?(button|textarea|form|input|select|option|label).*?&gt;)/g, output : '<u>$1</u>' }, // forms
View gist:189257
<div class="primary_fields">
{{ form.list }}
{{ form.name }}
{{ form.description }}
{{ form.url }}
</div>
# etc
And each of the form.fieldname lines (whatever the markup would be) would be doing something like this, but maybe with real code instead of the template language:
View gist:94603
testing ActiveSupport::Cache with different versions of memcache_client:
see test in http://gist.github.com/94481
memcache_client version: 1.5.0
7.610000 0.510000 8.120000 ( 9.603848)
memcache_client version: 1.5.0.1
8.010000 0.490000 8.500000 ( 9.738587)
memcache_client version: 1.5.0.5
You can’t perform that action at this time.