Skip to content

Instantly share code, notes, and snippets.

View stuartrexking's full-sized avatar

Stuart King stuartrexking

  • Townsville, QLD.
View GitHub Profile
if lat && long:
if sort param:
use sort param:
else:
use lat long
else:
if sort param other than lat/long:
use sort param
else:
use created_at
server {
listen 80;
server_name domain.com www.domain.com;
location / {
proxy_pass http://anotherdomain/index.html;
proxy_set_header X-Real-IP $remote_addr;
}
location ~ ^/(.*\Z) {
rewrite ^/(.*) http://domain.com permanent;
#! /usr/bin/ruby
require 'rubygems'
require 'fog'
require 'json'
require 'optparse'
USAGE = "usage: bootstrap.rb build_number "
#defaults
@stuartrexking
stuartrexking / gist:1276291
Created October 10, 2011 19:31
apt adding key and source
Expected line:
deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen
Actual line:
deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart 10gen
-----
apt_repository "mongo10gen" do
uri "http://downloads-distro.mongodb.org/repo/ubuntu-upstart"
@stuartrexking
stuartrexking / gist:1279859
Created October 12, 2011 00:18
Stacktrace
Generated at Wed Oct 12 00:12:50 +0000 2011
Net::HTTPServerException: 400 "Bad Request"
/usr/lib/ruby/1.8/net/http.rb:2105:in `error!'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/rest.rb:237:in `api_request'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/rest.rb:288:in `retriable_rest_request'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/rest.rb:218:in `api_request'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/rest.rb:114:in `get_rest'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/search/query.rb:42:in `search'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/mixin/language.rb:136:in `search'
/var/chef/cache/cookbooks/mongodb/definitions/mongodb.rb:137:in `from_file'
@stuartrexking
stuartrexking / gist:1279864
Created October 12, 2011 00:20
Replicaset Role
name "mongodb_repl"
description "mongo db server"'
default_attributes "mongodb" => { "cluster_name" => "m.prod.company.com" }'
run_list(
"recipe[mongodb::10gen_repo]","recipe[mongodb::replicaset]"
)
Wed Oct 12 19:02:45 [conn1562] end connection 50.16.46.229:55446
Wed Oct 12 19:02:50 [initandlisten] connection accepted from 50.16.46.229:55448 #1563
Wed Oct 12 19:02:50 [conn1563] end connection 50.16.46.229:55448
Wed Oct 12 19:02:51 [initandlisten] connection accepted from 50.16.46.229:55449 #1564
Wed Oct 12 19:02:51 [conn1564] authenticate: { authenticate: 1, user: "piazzza", nonce: "7f4944ded70bbc76", key: "8d2262f63a728c2d38dd3ff9e1de3ab5" }
Wed Oct 12 19:02:51 [conn1564] auth: couldn't find user piazzza, piazzza.system.users
Wed Oct 12 19:02:51 [conn1564] end connection 50.16.46.229:55449
Wed Oct 12 19:02:55 [initandlisten] connection accepted from 50.16.46.229:55451 #1565
Wed Oct 12 19:02:55 [conn1565] end connection 50.16.46.229:55451
Wed Oct 12 19:02:55 [initandlisten] connection accepted from 50.16.46.229:55452 #1566
Bug - Once a story has been resolved, a Bug (defect) is something that does not constitute being within the acceptance criteria or definition of a story. Speaks for itself.
New Feature - A new change that will impact the user or client(s) (new screens, new endpoints)
Task - A necessary change that adds value to the platform or processes without impacting the user.
Improvement - A change that has no visible impact on the end user (adding indexes to the db, optimizing code, removing code)
Epic - An issue that describes a significant change to the application. This issue would link to all the sub-issues/
Story - unused
@stuartrexking
stuartrexking / gist:1671252
Created January 24, 2012 17:18
Mkae this leaner
private void mapCover(ProfileDocument profileDocument, UpdateProfile updateProfile) {
boolean updateTitle = StringUtils.isNotBlank(updateProfile.getCoverTitle());
boolean updateCoverMedia = CollectionUtils.isMapNotEmpty(updateProfile.getCoverMedia());
if (updateTitle || updateCoverMedia) {
UserCoverDocument document = profileDocument.getCover();
if (null == document) {
document = new UserCoverDocument();
profileDocument.setCover(document);
}
stuartrexking:~/Workspace/wenzani git:wzn-235@b373467
→ mvn -pl sync-api clean compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building sync-api 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.ical:rfc-2445:jar:r31 is missing, no dependency information available
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ sync-api ---