Skip to content

Instantly share code, notes, and snippets.

@Relequestual
Relequestual / a path forward.md
Last active November 4, 2019 11:36
GA4GH Search - A path forward
@Relequestual
Relequestual / migrations.php
Created November 16, 2012 16:09
Run multiple sql queries with CodeIgniter migrations
/*
Assuming you have an SQL file (or string) you want to run as part of the migration, which has a number of statements...
CI migration only allows you to run one statement at a time. If the SQL is generated, it's annoying to split it up and create separate statements.
This small script splits the statements allowing you to run them all in one go.
*/
$sqls = explode(';', $sql);
array_pop($sqls);
foreach($sqls as $statement){
@Relequestual
Relequestual / search_api_rc_5_retrospective.md
Last active September 4, 2019 14:58
Search API - RC 5 Retrospective

Search API - RC 5 Retrospective

Preface

A retrospective is an agile process for continuous improvement of a team and their processes.

Firstly, thank you all for your contributions to the Search API specification, and those who spent much time leading up to the plenary implementing and raising questions! I know first-hand that open source work is hard, especially with a distributed team, committing time as and when they are able.

Thank you also to those who were able to attend the GA4GH plenary in Basel a while back. We had some great discussions, and I feel I made some great connections across other workstreams and projects.

@Relequestual
Relequestual / proposal.md
Last active April 8, 2019 10:59
GA4GH Search API Proposal

GA4GH Search API Proposal - Components

Executive Summary

The Matchmaker Exchange API is a successful live operating system which has resulted in real world life altering discoveries. Work on the Matchmaker Exchange API has shown that, while meeting most of the limited MME use cases, a more generalised discovery based API needs to be flexible, extensible, and planned for long term use.

A new discovery search based API should be expected to be in use for a minimum two decades once operational.

Keeping the barrier to entry low while not compromising on utility is essential. Each implementation of the API should be able to update to newer versions of the API at their own pace, without compromising interoperability. Each data repository exposing its data must be able to use as much or as little data for searching and responding to requests, is key.

"questionA": {
"type": "object",
"properties": {
"answer": {
"type": "string",
"minLength": 1,
"enum": ["Yes", "No"]
}
}
}
@Relequestual
Relequestual / idrefschema.json
Created February 7, 2018 16:55
Modified question schema
{
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",
"allOf": [
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$id": "http:/example.org/example.schema.json",
"type": "object",
"properties": {
"type": {
@Relequestual
Relequestual / BaseScene.swift
Created February 2, 2016 12:47
How to delegate a touch event to an entity when the entity has a component where the SKSpriteNode was defined, and the spritenode is underneeth another node based on z-index
// BaseScene.swift
// Hospital Demo
//
// Created by Ben Hutton on 17/11/2015.
// Copyright © 2015 Ben Hutton. All rights reserved.
//
import Foundation
import SpriteKit
import GameplayKit
  • sign in with twitter
  • import favourites
  • email user when import complete
  • view list of favourites
  • view all faves with images
  • view all faves with/out links
  • archive fave (de faves but kept on site)
  • search faves
  • search faves linked pages (so when import, save a cache of the article content or link included)
  • order by date
@Relequestual
Relequestual / gist:5583353
Last active December 17, 2015 08:49
Get total count for use with pagination for MySQL
//if your query is raw sql you created, each mysql key word must be on a new line for this to work
$last_query = $this->db->last_query();
$pattern = '/(.*)Limit (.*)/i';
$new_query = preg_replace ($pattern, '', $last_query);
$pattern = '/(.*)Select *(.*)/i';
$new_query = preg_replace ($pattern, 'SELECT \'\'', $new_query);
$new_query = 'Select Count(*) AS res From (' . $new_query . ') v__dynamic;';
@Relequestual
Relequestual / Onepage.php
Created March 28, 2013 14:22
Magento files for question posted on stackoverflow
<?php
class CheckTest_Model_Checkout_Type_Onepage extends Mage_Checkout_Model_Type_Onepage{
public function saveTestCheck($data){
//echo 'lalala';exit;
if (empty($data)) {
return array('error' => -1, 'message' => $this->_helper->__('Invalid data.'));
}
$this->getQuote()->setTestCheckLike($data['like']);
$this->getQuote()->collectTotals();