Instantly share code, notes, and snippets.

View README.md

Place the Docker Compose config file in the root of a project folder.

Ensure you've got your Docker Machine setup to use a large amount of memory, try 8GB.

Then run docker-compose up.

Once you've seen the serving http/json on port 8081 message come up, run curl http://0.0.0.0:8081/\?query\=Twatt,Scotland

View jquery-svg.js
$.fn.SVG = function() {
var $img = $(this);
var imgID = $img.attr('id');
var imgClass = $img.attr('class');
var imgURL = $img.attr('src');
return new Promise(function(resolve, reject) {
$.get(imgURL, function(data) {
// Get the SVG tag, ignore the rest
var $svg = $(data).find('svg');
View proxy.js
var myObject = {
testing: 'Hello',
};
var myProxiedObject = new Proxy(myObject, {
get: function(target, prop) {
console.log({ type: 'get', target, prop });
return Reflect.get(target, prop);
},
set: function(target, prop, value) {
View color.go
package main
import (
"fmt"
"strconv"
)
type Hex string
type RGB struct {
View keybase.md

Keybase proof

I hereby claim:

  • I am craigchilds94 on github.
  • I am arcraig (https://keybase.io/arcraig) on keybase.
  • I have a public key ASD9qZ1FWPt1mdf02cJu9ccRuq9vNivraONG7IBLkxSzKQo

To claim this, I am signing this object:

View dea_validate.php
<?php
if (!function_exists('dea_validate')) {
/**
* Validate a provided DEA number is valid.
*
* @param string $deaNumber
* @return boolean
*/
View main.go
import (
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/sqlite"
"encoding/json"
"fmt"
)
// The model.
type User struct {
gorm.Model
View Duplicator.js
/**
* Duplicate a row by the click of an
* element. Pass a callback to grab the new
* row and handle it how you please.
*
* @param {string} selector
* @param {Function} callback
*/
function Duplicator(selector, callback) {
this.selector = selector;
View Templater.js
/**
* Templater instance, pass in the selector for your template. And
* a key'd object with your data. Use "{{ key }}" in your template
* to replace values from this array.
*/
function Templater(template, data) {
this.template = template;
this.html = $(template).html();
this.data = data;
View time_taken.php
<?php
/**
* Work out time taken to run a block, give it a nice name/label
* and output a nice message.
*
* @param string $name
* @param callable $call
* @return mixed
*/