Skip to content

Instantly share code, notes, and snippets.

View dantman's full-sized avatar

Daniel Friesen dantman

View GitHub Profile
@dantman
dantman / git.diff
Created December 14, 2015 01:58
Juice styleFilter patch
diff --git a/client.js b/client.js
index 9deb594..44488de 100644
--- a/client.js
+++ b/client.js
@@ -282,7 +282,7 @@ function inlineContent(html, css, options) {
function getStylesData($, options) {
var results = [];
var stylesList = $("style");
- var styleDataList, styleData, styleElement;
+ var styleDataList, styleData, styleElement, filterResult;
Anonymous UUID: E3BDDC68-FEB5-8FE4-33CF-270703B78232
Thu Oct 1 10:57:33 2015
panic(cpu 0 caller 0xffffff802a475d4d): "missing pager for copy object"@/SourceCache/xnu/xnu-2422.115.14/osfmk/vm/vm_pageout.c:794
Backtrace (CPU 0), Frame : Return Address
0xffffff8031dc3b30 : 0xffffff802a423139
0xffffff8031dc3bb0 : 0xffffff802a475d4d
0xffffff8031dc3d50 : 0xffffff802a478f14
0xffffff8031dc3f20 : 0xffffff802a4dd05c
0xffffff8031dc3fb0 : 0xffffff802a4f438b
{
"countries": {
"AD": {
"name": "Andorra",
"abbr": "AD",
"zones": [
"Europe/Andorra"
]
},
"AE": {
@dantman
dantman / app.js
Last active August 29, 2015 14:21
"use strict";
var contrivedFoo = require('./contrivedFoo');
contrivedFoo.foo();
"use strict";
var createObject = require('./createObject');
var contrivedExample = createObject( 42 );
#!/usr/bin/env node
"use strict";
process.bin = process.title = 'mediawiki-extensionservice-cron';
require('../lib/check-env');
var Promise = require('bluebird');
Promise.longStackTraces();
var _ = require('lodash'),
fmt = require('util').format,
chalk = require('chalk'),
@dantman
dantman / results.txt
Last active December 18, 2015 05:49
Benchmarking different types of html escapes. strtr vs various ways of doing str_replace.
Daniels-MacBook-Air:5735077 daniel$ php test.php
escape1: 52.938008308411µs.
escape2: 11.997318267822µs.
escape3: 11.176705360413µs.
escape4: 11.816596984863µs.
escape5: 10.962629318237µs.
escape6: 12.953281402588µs.
Daniels-MacBook-Air:5735077 daniel$ php test.php
escape1: 54.372382164001µs.
escape2: 11.764526367188µs.
@dantman
dantman / index.html
Created June 3, 2013 03:25
Testing to ensure that an RDFa rel=":stylesheet" will NEVER be treated as rel="stylesheet"
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>rel=":stylesheet" safety test</title>
<link rel="stylesheet" href="safe.css">
<link rel=":stylesheet" href="unsafe.css">
</head>
<body>
<p>Background color indicates safety within this browser; Blue = Safe, only rel="stylesheet" is loaded. Red = Unsafe, rel=":stylesheet" was loaded as a stylesheet.</p>
@dantman
dantman / composer.json
Last active December 17, 2015 22:19
Testing nested RDFa foaf and foaf in <head> using bnodes.
{
"require": {
"easyrdf/easyrdf": "@beta"
}
}
@dantman
dantman / ns.php
Last active December 17, 2015 20:09
A script to scan over prefix.cc and determine the most popular patterns for rdf namespace IRIs
<?php
$ns = json_decode( file_get_contents( "http://prefix.cc/popular/all.file.json" ) );
foreach ( $ns as $k => $v ) {
if ( is_null( $v ) ) {
unset( $ns->{$k} );
}
}
$types = array( '/ns/', '/ns#', '/rdf/', '/rdf#', '/ns/', '/ns#', '/schema/', '/schema#', '/ontologies/', '/ontologies#', '/vocab/', '/vocab#', '/namespaces/', '/namespaces#', '/ontology/', '/ontology#', '/xml/', '/xml#', '/owl/', '/owl#', '/schema/', '/schema#', '/spec/', '/spec#', '/terms/', '/terms#', '/schemas/', '/schemas#' );
$types = array_combine( $types, array_fill( 0, count( $types ), 0 ) );