Skip to content

Instantly share code, notes, and snippets.

View CloCkWeRX's full-sized avatar

Daniel O'Connor CloCkWeRX

View GitHub Profile
@CloCkWeRX
CloCkWeRX / current destroy photo
Last active November 30, 2016 02:17
Managing sets of relationships with an Operation
PhotosController
def destroy
@photo = Photo.find(params[:id])
@photo.destroy
end
Planting
before_destroy do |planting|
photolist = planting.photos.to_a # save a temp copy of the photo list
planting.photos.clear # clear relationship b/w planting and photo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@CloCkWeRX
CloCkWeRX / Apple-logo-300x300.png
Last active January 3, 2016 01:49
thingsystem - front page
Apple-logo-300x300.png
var http = require('http')
, os = require('os')
, url = require('url')
, SSDP = require('../steward/node_modules/node-ssdp')
, netmask = require('../steward/node_modules/netmask')
, xml2json = require('../steward/node_modules/xml2json')
;
SSDP.prototype.notify = function(ifname, ipaddr, portno, signature, vars) {/* jshint unused: false */
var http = require('http')
, os = require('os')
, url = require('url')
// , SSDP = require('../steward/node_modules/node-ssdp')
, netmask = require('../steward/node_modules/netmask')
, xml2json = require('../steward/node_modules/xml2json')
;
'use strict';
var dgram = require('dgram')
@CloCkWeRX
CloCkWeRX / gist:4552043
Created January 16, 2013 23:34
Have a data set with a 'parent' and 'child' column, storing paths through a tree (see http://fungus.teststation.com/~jon/treehandling/TreeHandling.htm for the modelling). At the moment, there's a stored proc that takes exactly one ID and builds a data set like the below. Trying to neatly re-write this as a view, so that I can simply add in the "…
SELECT
*
FROM data
WHERE id IN(
SELECT @id
UNION
SELECT child_id FROM paths WHERE parent_id = @id
)
DROP TABLE example;
CREATE TABLE example (
primary_id int PRIMARY KEY IDENTITY,
id int,
name varchar(20),
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME,
active int
);
deploy@kyle:~/fe/current$ rvm debug pkg install openssl
Fetching openssl-1.0.1c.tar.gz to /home/deploy/.rvm/archives
Extracting openssl-1.0.1c.tar.gz to /home/deploy/.rvm/src
Configuring openssl in /home/deploy/.rvm/src/openssl-1.0.1c.
Compiling openssl in /home/deploy/.rvm/src/openssl-1.0.1c.
Installing openssl to /home/deploy/.rvm/usr
Please note that it's required to reinstall all rubies:
rvm reinstall all --force
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head><title>SPARQL httpd test query</title></head>
<body><h1>SPARQL httpd server v1.1.4 test query</h1>
<h2>KB reference_store</h2>
<form action="http://127.0.0.1:8000/sparql/" method="post">
<textarea name="query" cols="80" rows="18">
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT * WHERE {