Skip to content

Instantly share code, notes, and snippets.

Avatar

Guy Taylor xsyn

View GitHub Profile
View gist:11399636
### Keybase proof
I hereby claim:
* I am xsyn on github.
* I am xsyn (https://keybase.io/xsyn) on keybase.
* I have a public key whose fingerprint is FBAF 44F4 035D 5179 AEBA 3640 BD74 1D1B 1DBA 0FB7
To claim this, I am signing this object:
View Access log gist
[
;; Access Log Schema
{db/id #db/id[:db.part/db]
:db/ident :access/ip
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db/doc "Requester IP address"
:db.install/_attribute :db.part/db}
{db/id #db/id[:db.part/db]
View gist:6041717
(let [completed-map {
:users {
:email (get params :user)
:adv1 (get params :adv1)
:adv2 (get params :adv2)
:adv3 (get params :adv3)
:inf1 (get params :inf1)
:inf2 (get params :inf2)
:inf3 (get params :inf3)
:trt1 (get params :trt1)
View import.clj
(ns sumphonos.import
(:use [compojure.core]
[ring.middleware.params]
[ring.middleware.multipart-params]
[ring.adapter.jetty]
[clojure.java.io :only [reader copy]]
[hiccup.page :only [include-js]])
(:require [clojure-csv.core :as csv]
[sumphonos.database :as mg]
[sumphonos.views.layout :as layout])
View gist:4193705
#!/bin/bash
if [ $# -lt 1 ]
then
echo "Usage: ${0##*/} user@host"
echo " Adds your id_rsa.pub to the desitnation authorized_keys2 file"
exit 1
fi
if [ ! -f ~/.ssh/id_rsa.pub ]
View account.rb
cattr_accessor :current_account
self.authorizer_name = 'AccountAuthorizer'
77: after_create do
78: RuoteKit.engine.launch(ProcessDefinition.account_creation, account_id: self.id.to_s, :object_type => 'Account')
79: end
@xsyn
xsyn / data
Created May 23, 2012
home.jade
View data
{"total_rows":2,"offset":0,"rows":[
{"id":"202638c9041c87a2e01e1a320600074d","key":"202638c9041c87a2e01e1a320600074d","value":{"_id":"202638c9041c87a2e01e1a320600074d","_rev":"6-b28aa64f065a183c86c9d2097a1c81a7","company":"SAPA","project":"Replace wires system","contact":"Munetsi Chiunda","created":"","nextStep":"Roll-out prototype","value":"300000.00","state":{"0":"2012/3/15","1":"2012/4/19"},"type":"global"}},
{"id":"202638c9041c87a2e01e1a320600098c","key":"202638c9041c87a2e01e1a320600098c","value":{"_id":"202638c9041c87a2e01e1a320600098c","_rev":"7-7db0c0d4640bf7f070f4c34d7f746d2d","company":"ITWeb","project":"News diary","contact":"Jon Tullet","created":"2012/5/15","state":{"0":"2012/5/15","1":"2012/5/19"},"nextStep":"Get functional specficiation","value":"150000.00","type":"global"}}
]}
View gist:2762534
// This is the original object:
{"total_rows":2,"offset":0,"rows":[
{"id":"202638c9041c87a2e01e1a320600074d","key":"202638c9041c87a2e01e1a320600074d","value":{"_id":"202638c9041c87a2e01e1a320600074d","_rev":"6-b28aa64f065a183c86c9d2097a1c81a7","company":"SAPA","project":"Replace wires system","contact":"Munetsi Chiunda","created":"","nextStep":"Roll-out prototype","value":"300000.00","state":{"0":"2012/3/15","1":"2012/4/19"},"type":"global"}},
{"id":"202638c9041c87a2e01e1a320600098c","key":"202638c9041c87a2e01e1a320600098c","value":{"_id":"202638c9041c87a2e01e1a320600098c","_rev":"7-7db0c0d4640bf7f070f4c34d7f746d2d","company":"ITWeb","project":"News diary","contact":"Jon Tullet","created":"2012/5/15","state":{"0":"2012/5/15","1":"2012/5/19"},"nextStep":"Get functional specficiation","value":"150000.00","type":"global"}}
]}
// This is the object I want to create:
{"title": "SAPA", "data":"[[1331762400000, 0], [1334786400000, 1], [1337608923775, 1]},
@xsyn
xsyn / gist:2593326
Created May 4, 2012
Problem is the response in res.send is undefined.
View gist:2593326
app.get('/products', function(req, res) {
var Client = http.createClient(80, 'local.10layer.com');
var request = Client.request("GET", '/workers/api/section/products', {'host' : 'local.10layer.com'});
request.addListener("response", function(response) {
var body = "";
response.addListener("data", function(data) { //Add listener for the actual data
body += data; //Append all data coming from api to the body variable
});
View gist:1438583
// View a dream
app.get('/dreams/:id?.:format?', function(req, res) {
dreamModel.findById(req.params.id, function(err, docs) {
// Try and get images returning from db
console.log("Returning docs object for attachments: " + eyes.inspect(docs))
console.log("Checking for Attachments!!!");
if (docs._attachments) {
var promise = new(events.EventEmitter), response = {};
var streamer = db.getAttachment(docs._id, docs.filename);
streamer.addListener('response', function (res) {
You can’t perform that action at this time.