Skip to content

Instantly share code, notes, and snippets.

View technosophos's full-sized avatar
💭
Rust

Matt Butcher technosophos

💭
Rust
View GitHub Profile
@technosophos
technosophos / issue-133.php
Created March 3, 2014 02:06
QueryPath issue #133: Attempt to reproduce.
<?php
require_once "vendor/autoload.php";
$HTML = <<<EOL
<html>
<head>
<title>Foo</title>
</head>
<body>
<p>foo</p>
@technosophos
technosophos / tag_category_list.rb
Created March 12, 2014 14:38
Jekyll Category Listing Plugin
module Jekyll
class CategoryListTag < Liquid::Tag
# safe true
def initialize(tag_name, text, tokens)
super
end
def render(context)
html = ""
@technosophos
technosophos / colorizer.go
Created March 19, 2014 03:18
This broke the io.Multiwriter because I had Colorizer.Write() returning the number of bytes it wrote, not the number of bytes passed into it.
package main
import (
"github.com/Masterminds/cookoo"
"github.com/Masterminds/cookoo/io"
"os"
)
func main() {
_, _, cxt := cookoo.Cookoo()
### Keybase proof
I hereby claim:
* I am technosophos on github.
* I am technosophos (https://keybase.io/technosophos) on keybase.
* I have a public key whose fingerprint is ABA2 5295 98F6 626C 420D 335B 62F4 9E74 7D91 1B60
To claim this, I am signing this object:
@technosophos
technosophos / gist:1b7c68ea8b9330c7e45f
Created June 7, 2014 04:28
Apple Script to Raise and Focus the First MacVIM Window
tell application "MacVim"
activate
set visible of first window to true
end tell
@technosophos
technosophos / gist:32b1815a4ff26cf5bf48
Created September 23, 2014 03:55
Example of Cookoo subcommand.
package main
import (
"github.com/Masterminds/cookoo"
"github.com/Masterminds/cookoo/cli"
"github.com/Masterminds/cookoo/fmt"
"flag"
)
@technosophos
technosophos / gist:0e743e51ab94c8f814e9
Created December 20, 2014 17:26
BonsaiJS Christmas Tree
treegreen = color('green');
new Text('Merry Christmas').addTo(stage).attr({
fontFamily: 'Arial, sans-serif',
fontSize: '48',
textFillColor: 'red',
textStrokeColor: 'green',
textStrokeWidth: 2,
x: -400
}).animate('2s', {x:150, y:50}, {
easing: "bounceIn"
This is a random gist for sdboyer.
<?php
require "../querypath/src/QueryPath/QueryPath.php";
$apikey = 'YOUR_KEY_HERE';
$text = 'YOUR TEXT HERE';
/*
// Code for working with this.
$qp = qp('./amp2.xml');
@technosophos
technosophos / gist:659948
Created November 2, 2010 17:12
Faster checkPlain()?
function checkPlain(str) {
var r = new RegExp('(&)|(\")|(<)|(>)|([^&\"<>]*)', 'g');
var replacements = ["&amp;", "&quot;", "&lt;", "&gt;"];
var retval = '';
var match = r.exec(str);
while (match[0] != "") {
for (var i = 1; i < match.length; ++i) {
if (match[i] != undefined) {
retval += (i == 5 ? match[i] : replacements[i-1]);
}