Skip to content

Instantly share code, notes, and snippets.

View technosophos's full-sized avatar
💭
Rust

Matt Butcher technosophos

💭
Rust
View GitHub Profile
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]);
}
.node-unpublished{background-color:#fff4f4;}.preview .node{background-color:#ffffea;}#node-admin-filter ul{list-style-type:none;padding:0;margin:0;width:100%;}#node-admin-buttons{float:left;
margin-left:0.5em;
clear:right;}td.revision-current{background:#ffc;}.node-form .form-text{display:block;width:95%;}.node-form .container-inline .form-text{display:inline;width:auto;}.node-form .standard{clear:both;}.node-form textarea{display:block;width:95%;}.node-form .attachments fieldset{float:none;display:block;}.terms-inline{display:inline;}
fieldset{margin-bottom:1em;padding:.5em;}form{margin:0;padding:0;}hr{height:1px;border:1px solid gray;}img{border:0;}table{border-collapse:collapse;}th{text-align:left;
padding-right:1em;
border-bottom:3px solid #ccc;}
@technosophos
technosophos / testmode.php
Created February 15, 2012 17:43
Test File Mode (PHP)
<?php
if (count($argv) < 2) {
print "Usage: php testmode.php file [file [...]]" . PHP_EOL;
exit(1);
}
array_shift($argv);
foreach ($argv as $file) {
print "=== Testing $file" . PHP_EOL;
@technosophos
technosophos / gist:2597260
Created May 4, 2012 19:43
install_multisite
# Deploy an example Drupal site.
# TODO Move this to a definition with parameters.
require_recipe "mysql"
require_recipe "drush"
require_recipe "drush_make"
docroot = "#{node[:www_root]}/drupal/www"
cookbook_file "#{node[:www_root]}/drupal/drupal.make" do
source node[:drupal][:makefile]
Vagrant::Config.run do |config|
# All Vagrant configuration is done here. For a detailed explanation
# and listing of configuration options, please view the documentation
# online.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "base"
# config.vm.boot_mode = :gui
config.vm.customize do |vm|
@technosophos
technosophos / drupal_dev.rb
Created May 19, 2012 12:44
roles/drupal_dev.rb
name "drupal_dev"
description "Useful tools for Drupal developers."
run_list(
"recipe[drupal::dev]",
"recipe[drush]", # TRY THIS!
#"recipe[drush::head]",
#"recipe[drush::pear]",
"recipe[drush_make]",
"recipe[phpmyadmin]", # TODO Cookbook needs testing!
"recipe[webgrind]", # TODO Does this actually work?
@technosophos
technosophos / gist:4259125
Created December 11, 2012 15:00
Element creation in QP
<?php
//define('QP_NO_AUTOLOADER', TRUE);
require 'src/qp.php';
function examples_qptest() {
$qp = qp("<?xml version=\"1.0\" encoding=\"UTF-8\"?><root/>");
$i = 0;
while ($i < 200) {
$issuerType = rand() ? 'type1' : 'type2';
$firstName = md5(rand(0,100000));
package main;
import (
"fmt"
);
func main() {
var m = make(map[string]interface{})
mf := new(MonkeyFace)