Skip to content

Instantly share code, notes, and snippets.

View patrickkettner's full-sized avatar

patrick kettner patrickkettner

View GitHub Profile
@patrickkettner
patrickkettner / Gemfile
Last active January 23, 2017 20:41
opal bug #1581
source 'https://rubygems.org'
gem "temple", "0.6.5"
gem "opal"
Gem::Specification.new do |gem|
gem.name = 'OLD_RUBY_CGI_ESCAPE'
gem.version = '1.0.0'
gem.date = Date.today.to_s
gem.summary = "pure ruby HTML escaping extracted from the CGI module from Ruby <= 2.4"
gem.description = "extended description"
gem.authors = ['Nobuyoshi Nakada', 'Eric Hodel', 'Yui NARUSE', 'Kenta Murata', 'Zachary Scott', 'Patrick Kettner']
gem.email = 'patrickkettner@gmail.com'
var browserslist = require('browserslist');
var request = require('sync-request');
var res = request('GET', 'https://saucelabs.com/rest/v1/info/browsers/webdriver');
function lookup(requestedBrowsers, cb) {
var result = {};
var sauce = JSON.parse(res.getBody().toString())
//console.log(sauce);
// grab a reference to all scripts on the page, keep in mind this
// will only include all of the <script> elements that have been
// parsed up until this point
var scripts = document.getElementsByTagName('script');
// cheat and use currentScript if it exists, otherwise grab the last
// script tag, which will be the current running script tag sense the
// getElements call can't see nodes in the future
var currentScript = document.currentScript || scripts[scripts.length - 1];
http://codepen.io/patrickkettner/pen/pEzXEy
@patrickkettner
patrickkettner / find_users.sh
Created January 11, 2016 19:29
match commits from a subdirectory to the github usernames that commited them
#!/bin/bash
SINCE_STRING="6.months.ago"
DIRECTORY_TO_CHECK="./test"
if [ ! -d $DIRECTORY_TO_CHECK ]; then
echo "$DIRECTORY_TO_CHECK does not exist - update the script"
exit 1
fi
GITHUB_URL=$(git config --get remote.origin.url | awk -F "[:|.]" '{print $3}')
<!doctype html>
<html>
<head>
<title></title>
</head>
<body>
// ⬇⬇ view the source of the below svg file ⬇⬇
<object type="image/svg+xml" data="foo.svg"></object>
</body>
</html>
require(['./lodash.js'], function(_) {
console.log(_);
});
@patrickkettner
patrickkettner / index.js
Created September 30, 2014 04:28
requirebin sketch
var Handlebars = require('handlebars');
Handlebars.registerHelper('uuid', function(obj) {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random() * 16 | 0,
v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
});
/**package
{ "name": "modernizr",
"version": "2.8.3",
"description":"Modernizr, without the complaints" }
**/
/*!
* Modernizr v2.8.3
* www.modernizr.com
*