Skip to content

Instantly share code, notes, and snippets.

View JohnMurray's full-sized avatar

John Murray JohnMurray

View GitHub Profile
@JohnMurray
JohnMurray / after.php
Last active December 14, 2015 19:49
gists for blog post on Pinatra (PHP Sinatra clone) as a tool for learning
Pinatra::after('*', function () {
Logger::log_request('served yet another request');
});
@JohnMurray
JohnMurray / test.rs
Last active December 12, 2015 10:39
simple rust program
struct MyStruct {
mut count : int
}
impl MyStruct {
fn inc(&mut self) -> () { (*self).count += 1; }
}
fn main() -> () {
let STAT : MyStruct = MyStruct { count: 1 };
@JohnMurray
JohnMurray / compiling-rust.sh
Created September 29, 2012 20:06
gist for blog entry on johnmurray.io
# get all of the necessary tools to build
sudo yum install gcc-c++ llvm llvm-devel perl wget
# following rust-lang.org's instructions
wget http://dl.rust-lang.org/dist/rust-0.3.tar.gz
tar -xzf rust-0.3.tar.gz
cd rust-0.3
./configure
make -j 4 && make install
@JohnMurray
JohnMurray / det.rb
Created August 19, 2012 20:03
Geofencing (part 2) Blog Post
# Get the determinant of a line and a point. This is conceptually
# represented by the following:
#
# point = (a,b)
# line = [(x1, y1), (x2, y2)], such that y2 > y1
#
# matrix:
# | (x2 - x1) (a-x1) |
# | (y2 - y1) (b-y1) |
#
@JohnMurray
JohnMurray / URL-1.txt
Created August 19, 2012 18:54
Versioning WCF Web APIs Blog Post (http://goo.gl/PkCVc)
http://api.mysite.com/UserInfo/<MethodName>
http://api.mysite.com/CarInfo/<MethodName>
@JohnMurray
JohnMurray / redis-queue-name.cs
Created August 18, 2012 17:35
Fnord Metric and C# Blog Post (http://goo.gl/F8MH5) -- Part 2
String.Format("mavia-metrics-{0}", guid);
@JohnMurray
JohnMurray / JSON.js
Created August 18, 2012 17:18
Fnord Metric and C# Blog Post (http://goo.gl/F8MH5) -- Part 1
{ "_type": "login" }
@JohnMurray
JohnMurray / ex.sql
Created July 5, 2012 11:56
Link Multi-Where
select *
from (
select *
from carModels as t1,
carMakes as t2
where t1.somePKId = t2.someFKId
and (
t1.Name like '%c%'
or t2.Name like '%c%'
)
@JohnMurray
JohnMurray / how_to.md
Created June 12, 2012 18:24
A getting started guide to making requests to my sample geofence-server

John Murray's Sample Geofence Server

Hey, you ran the project! Good for you! You're probably wondering how the heck to use this thing. Well, keep reading and maybe you'll find out.

Pre-Requisites

  1. Install and run Mongo (on default port w/o a password)
  2. Install Gemset with Bundler
  3. Get the server running. (Hey look! You're ahead of the game!)

That's it... keep reading.

@JohnMurray
JohnMurray / CheckResponse.cs
Created June 4, 2012 00:03
Code descriptions for log-entry on API Anti-Patterns (johnmurray.io)
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
var statusCode = response.StatusCode;
return statusCode == HttpStatusCode.OK;