Skip to content

Instantly share code, notes, and snippets.

View rodebert's full-sized avatar

Robert Weber rodebert

View GitHub Profile
@rodebert
rodebert / gist:6228805
Last active December 21, 2015 01:38
All CSS colors in one select-Element.
<select name="color" id="form-color">
<option value="#F0F8FF">AliceBlue</option>
<option value="#FAEBD7">AntiqueWhite
<option value="#00FFFF">Aqua</option>
<option value="#7FFFD4">Aquamarine</option>
<option value="#F0FFFF">Azure</option>
<option value="#F5F5DC">Beige</option>
<option value="#FFE4C4">Bisque</option>
<option value="#000000" selected>Black</option>
<option value="#FFEBCD">BlanchedAlmond</option>
@rodebert
rodebert / gist:7371314
Created November 8, 2013 13:52
Which process is listening on $PORT on Mac OSX
lsof -n -i4TCP:$PORT | grep LISTEN
@rodebert
rodebert / main.js
Last active August 29, 2015 14:15
Rewrite of the WDRLs pie chart script to show animated chart.
/**
* Main.js
* https://github.com/anselmh/wdrl/blob/gh-pages/js/main.js
*
*/
(function (global) {
'use strict';
// Twitter Button
@rodebert
rodebert / gist:aea57e1e94ebce5b49cc
Created February 10, 2015 16:52
Statamic plugin to check if variable contains a string
<?php
class Plugin_contains extends Plugin {
public function index() {
$needle = $this->fetchParam('needle', '', null, false, false);
$haystack = $this->context[$this->fetch('haystack')];
return strpos($haystack, $needle) ? $this->content : false;
@rodebert
rodebert / copy.js
Created December 6, 2016 11:20
Copy main soure from dependencies
grunt.task.registerTask('copy-deps', 'Copy npm dependencies', function () {
var done = this.async();
var deps = Object.keys(pkg.dependencies);
var path = require('path');
var fs = require('fs');
if ( deps.length ) {
deps.forEach((dep) => {
@rodebert
rodebert / Gruntfile.js
Last active February 20, 2017 09:56 — forked from jensgro/Gruntfile.js
module.exports = function(grunt) {
require('time-grunt')(grunt);
require('load-grunt-tasks')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
copy: {
dist: {
files: [{
expand: true,
@rodebert
rodebert / index.js
Last active April 3, 2018 11:48 — forked from JayPanoz/index.js
A proof of concept script to append aria doc roles based on epub:type
"use strict";
// Get all the elements with epub:type
// Since querySelectorAll can’t be used with XHTML attributes,
// we create an array in which we’ll push elements with an epub:type attribute
// Mappings table (epub → role)
var mappings = {
"abstract":"doc-abstract",
"acknowledgments":"doc-acknowledgments",
// get the length of the longest classname in document
[].slice.call(document.querySelectorAll('body *')).filter(el => el.nodeType === 1 && typeof el.className === 'string').reduce( (m, el) => {
const l = el.className.split(' ').filter(classname => classname.length > m).sort((a,b) => a.length - b.length).shift();
return l ? l.length : m;
},0)
// get the longest classname
[].slice.call(document.querySelectorAll('body *')).filter(el => el.nodeType === 1 && typeof el.className === 'string').reduce( (m, el) => {