Skip to content

Instantly share code, notes, and snippets.

View kierangraham's full-sized avatar

Kieran Graham kierangraham

View GitHub Profile
@kierangraham
kierangraham / apidoc.css
Created April 5, 2018 08:57
Markdeep predict.io Style
/* Custom stylesheet for API documentation by Aras Pranckevičius, http://aras-p.info/
and tweaked by Morgan McGuire.
Licensed as public domain or BSD 2-clause, whichever is more convenient for you.
Originally from https://github.com/aras-p/markdeep-docs-style */
body {
max-width: 50em;
font-family: "Nunito", Helvetica, Arial, sans-serif;
text-align: left;
margin: 1.5em;
padding: 0 1em;
@kierangraham
kierangraham / app_store_diff.sh
Created November 9, 2017 17:25
Calculate the before and after size difference of an iOS App Store update.
#! /usr/bin/env sh
bitcode_strip="xcrun bitcode_strip"
strip="xcrun strip"
lipo="xcrun lipo"
archives=(*.xcarchive)
if [ ! ${#archives[@]} -eq 2 ] && [ ! -e "$archives[0]" ];
then
echo "There must be two Xcode archives to calculate the before and after size of the predict.io SDK."
exit -1
@kierangraham
kierangraham / belfastruby-20140204.md
Last active August 29, 2015 13:56
Companion notes for my Ruby on Ales Belfast Ruby talk on an Introduction to Ruby.

Belfast Ruby Notes - 4th Feb 2014

Companion notes for my 'Ruby on Ales' Belfast Ruby talk on an Introduction to Ruby. Slides are available on Speakerdeck.

Installing Ruby

One of the first and most important things to setup is a good text editor which you are comfortable using and will play nicely with Ruby projects. I'd recommend having a look at (and using) Sublime Text. It's an amazing editor, blazing fast, supports a huge amount of different languages and also has Mac, Windows and Linux support.

Mac (and Linux-ish)

@kierangraham
kierangraham / couchbase-ruby-client-heroku-error
Created April 11, 2013 14:13
Couchbase Ruby Client Heroku build error.
Installing couchbase (1.2.3)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/tmp/build_3h7fjy5bd2ir/vendor/ruby-2.0.0/bin/ruby extconf.rb --with-libcouchbase-dir=/app/vendor/couchbase
checking for lcb_verify_compiler_setup() in -lcouchbase... no
**********************************************************************
You must install libcouchbase >= 2.0.0beta3. See http://www.couchbase.com/develop/ for more details
**********************************************************************
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
@kierangraham
kierangraham / heroku-log.txt
Created July 12, 2012 11:57
Couchbase Ruby Client Errors
irb(main):021:0* Article.ensure_design_document!
Couchbase::Error::Protocol: Number of buckets must be a power of two > 0 and <= MAX_BUCKETS (error=0x15)
from /app/vendor/bundle/ruby/1.9.1/gems/couchbase-1.2.0.dp5/lib/couchbase.rb:51:in `initialize'
from /app/vendor/bundle/ruby/1.9.1/gems/couchbase-1.2.0.dp5/lib/couchbase.rb:51:in `new'
from /app/vendor/bundle/ruby/1.9.1/gems/couchbase-1.2.0.dp5/lib/couchbase.rb:51:in `connect'
from /app/vendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.0/lib/new_relic/agent/method_tracer.rb:491:in `block in connect_with_trace_Couchbase_connect'
from /app/vendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.0/lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped'
from /app/vendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.0/lib/new_relic/agent/method_tracer.rb:486:in `connect_with_trace_Couchbase_connect'
from /app/vendor/bundle/ruby/1.9.1/gems/couchbase-1.2.0.dp5/lib/couchbase.rb:82:in `bucket'
from /app/vendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.0/lib/new_reli
{
"query": {
"query_string": {
"query": "australia"
},
"custom_score": {
"query": {
"custom_filters_score": {
"query": {
"bool": {
@kierangraham
kierangraham / kieran-couchbase.txt
Created July 10, 2012 22:56
Couchbase Performance Benchmark
====> Testing all_by_id({:limit=>10, :include_docs=>true})
----> Run #1 - Couchbase took 14.37ms
----> Run #2 - Couchbase took 6.22ms
----> Run #3 - Couchbase took 5.91ms
----> Run #4 - Couchbase took 6.2ms
----> Run #5 - Couchbase took 7.01ms
----> Run #6 - Couchbase took 7.14ms
----> Run #7 - Couchbase took 6.34ms
----> Run #8 - Couchbase took 6.88ms
----> Run #9 - Couchbase took 7.56ms
@kierangraham
kierangraham / gist:2773123
Created May 23, 2012 03:35
issue with complex keys and startkey and endkey in couchbase-1.2.0.dp ruby client

# Couchbase 1.2.0.dp Complex Key Query

Here is what's needed in order to replicate an issue I'm having with querying complex startkey and endkeys with the Ruby Couchbase 1.2.0.dp.

Use Case

Basically I want to use this kind of map/reduce on a document structure like below to find out the number of type by each author and want to use :start_key and :end_key to get a result for a particular author.

Sample Documents

sudo gem install capistrano capistrano-ext railsless-deploy