Skip to content

Instantly share code, notes, and snippets.

View icio's full-sized avatar
💬
icio is typing...

Paul Scott icio

💬
icio is typing...
View GitHub Profile
@icio
icio / _redland-raptor-rasqal-osx.md
Last active August 29, 2015 14:03
Building Redland's Raptor RDF Syntax Library and Rasqal RDF Query Library on OSX
  1. Ensure that you have the relevant build tools at your disposal. build-essential ought to cover it.
  2. Download and run install.sh.
  3. Once the script has complete you'll need to sudo make install the packages that you're interested in (or run them locally) -- that's your call. If you're only after roqet then cd rasqal* && sudo make install
from itertools import groupby, count
def debug_iter(iter):
for x in iter:
print "=> %d" % x
yield x
def groupn(n, it):
@icio
icio / index.html
Created July 18, 2014 10:59
Fit polygon in box
<!--
https://gist.github.com/nnnick/696cc9c55f4b0beb8fe9
-->
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Polytext</title>
<style type="text/css">
.polytext {
@icio
icio / recurly-upgrade-2.1.2-2.3.1.patch
Created February 2, 2015 16:52
Recurly 2.1.2 → 2.3.1 Upgrade (./lib directory diff)
diff -r html/sites/all/libraries/recurly_v2/recurly/account.php vendor/recurly/recurly-client/lib/recurly/account.php
9c9,10
< function __construct($accountCode = null) {
---
> function __construct($accountCode = null, $client = null) {
> parent::__construct(null, $client);
11a13,15
> $this->address = new Recurly_Address();
> $this->balance_in_cents_invoiced = new Recurly_CurrencyList('balance_in_cents_invoiced');
> $this->balance_in_cents_uninvoiced = new Recurly_CurrencyList('balance_in_cents_uninvoiced');
@icio
icio / input.twig
Last active August 29, 2015 14:15
Twig JavaScript Escaping
{% set text = 'back & for"th' %}
<script>
console.log({
"str0": "{{ text }}",
"str1": "{{ 'back & for"th' }}",
"num1": {{ 123 }},
"str2": "{{ 'back & for"th' | e('html') }}",
"num2": {{ 123 }},
@icio
icio / array_benchmark.php
Last active August 29, 2015 14:21
Array merge benchmark
<?php
/*
$ php ~/test.php
Runs: 100,000
Benchmark Avg (s) Total (s)
---------- ---------- ----------
sum 0.000006 0.597605
merge 0.000007 0.713410
!ENTRY org.eclipse.ui 4 4 2010-09-10 15:43:00.865
!MESSAGE Exception in org.eclipse.ui.internal.PageLayout.addView: org.eclipse.ui.PartInitException: Could not create view: net.refractions.udig.project.ui.layerManager
!STACK 1
org.eclipse.ui.PartInitException: Could not create view: net.refractions.udig.project.ui.layerManager
at org.eclipse.ui.internal.ViewFactory.createView(ViewFactory.java:158)
at org.eclipse.ui.internal.LayoutHelper.createView(LayoutHelper.java:162)
at org.eclipse.ui.internal.PageLayout.createView(PageLayout.java:543)
at org.eclipse.ui.internal.PageLayout.addView(PageLayout.java:416)
at org.eclipse.ui.internal.PageLayout.addView(PageLayout.java:390)
at uk.co.terinea.agrimark.Perspective.createInitialLayout(Perspective.java:14)
@icio
icio / gist:720026
Created November 29, 2010 14:42
spanChars
function spanChars(e)
{
if (!e) e = document.body;
// Replace the text node with a span for each letter it consists of
if (e.nodeType == document.TEXT_NODE)
{
var text = e.nodeValue;
for (var c = 0; c < text.length; c++)
@icio
icio / gist:729309
Created December 5, 2010 18:13
largest_prime_factor
<?php
test();
/**
* The largest prime factor
*
* The provided number is not considered a factor of itself.
*
* @param int $n The number we wish to find a factor of
@icio
icio / gist:766327
Created January 5, 2011 13:48
include_subdirectories_in_path
<?php
/**
* Add each directory within ./application to the include path so that each file
* is easily accessible.
*/
function include_subdirectories_in_path()
{
global $paths;
$paths = array('application');