Skip to content

Instantly share code, notes, and snippets.

View fuzzyfox's full-sized avatar

William Duyck fuzzyfox

View GitHub Profile
@fuzzyfox
fuzzyfox / removeTrailingWhiltespace.php
Created September 22, 2020 19:09
Remove trailing whitespace from an input string (multiline).
function removeTrailingWhitespace(string $string) : string
{
return preg_replace('/[ \t]+(\r?)$/m', '$1', $string);
}
// PHPUnit testcase for method
// public function testTestInternalRemoveTrailingWhitespace()
// {
// $this->assertSame(
// "\n some\r\n string\n\n\r\nto remove trailing\n whitespace from.\n\n",
@fuzzyfox
fuzzyfox / _tooltip.scss
Created May 26, 2017 18:24
Super Simple, Tiny, SCSS tooltips.
$spacer: 1rem;
$tooltip-border-radius: ( 0.333 * $spacer );
[data-tooltip] {
position: relative;
&::before,
&::after {
opacity: 0;
pointer-events: none;
@fuzzyfox
fuzzyfox / maintainance.css
Created August 26, 2014 15:12
CSS: Hive Berlin Maintainance Page
html {
height: 100%;
padding: 0;
margin: 0;
}
body {
min-height: 100%;
padding: 0;
margin: 0 auto;
display: flex;
@fuzzyfox
fuzzyfox / string-composition.js
Created June 13, 2014 12:47
JavaScript: a small library to make manipulating strings in an iframe easier.
(function( window, document, undef ) {
'use strict';
function SC( iframe ) {
// check to see if an iframe was given to us, and
// utilize its document if possible
if ( iframe !== document ) {
this._doc = document.querySelector( iframe ).contentDocument || undef;
}
else {
@fuzzyfox
fuzzyfox / hack.js
Created May 24, 2014 01:23
JavaScript: hacky fix to solve a stupid problem (DO NOT USE)
request.get(env.get('EVENTS_SERVICE') + '/events?after=' + env.get('EVENTS_START_DATE'), function(error, response, events) {
if(!error && response.statusCode === 200) {
events = JSON.parse( events );
// array to dedupe organizers
var events_by_host = {};
var event_hosts = [];
// init stats object
var event_stats = {
hosts: 0,
attendees: 0,
@fuzzyfox
fuzzyfox / manual-kitbuilder-bugfix.md
Last active August 29, 2015 14:01
Note: The quick fix to kitbuilder stubs.

The quick fix to kitbuilder stubs.

If you've been using http://kitbuilder.webmakerprototypes.org/ this week then there is an unfortunate bug in your kits that prevents some of the magic that webmaker-kits provides. The fix is simple though.

There is a <script> tag at the bottom of the kit that includes dist/js/main.min.js this needs to be changed to //stuff.webmaker.org/webmaker-kits/v2/js/main.min.js. Once that is done the magic takes place. Any tags on the kit will automagically display in the kit sidebar, and any checklists (see the code snippet bellow) will have checkboxes added for you!

Hope this helps improve the awesome factor on your kits!

– FuzzyFox

@fuzzyfox
fuzzyfox / String.prototype.filter.js
Created April 5, 2014 01:33
JavaScript: String.prototype.filter
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* String.prototype.filter
*
* Allows for an arbitrary number of arguments which take a string as a single
* parameter, and return a string, to modify the string.
*
@fuzzyfox
fuzzyfox / readme.md
Created April 3, 2014 13:42
Bookmarklet: Super Goggles

Super Goggles

Takes Webmakers X-Ray Goggles and adds a little spice so that you can goggle on published Thimble projects.

Install

Compress the JS in supergoggles.js and add to your bookmarks toolbar. Then use in place of X-Ray Goggles.

My personal favourite tool to do this easily is http://userjs.up.seesaa.net/js/bookmarklet.html. Simply copy the code in supergoggles.js and paste it into the tool. Name the bookmarklet and drag the link at the bottom of the page to your bookmarks toolbar. Done.

@fuzzyfox
fuzzyfox / makeapi-suggest-tags.js
Created March 13, 2014 18:05
JavaScript: A small function to suggest tags for a page, based on things it links to w/i the MakeAPI
/* global define, module */
(function suggestMakeTagsRoot(){
'use strict';
// browser context getting dependency
if(typeof window !== 'undefined' && !window.Make){
var script = document.createElement('script');
script.src = '//webmaker.org/bower/makeapi-client/src/make-api.js';
script.onload = function(){
suggestMakeTagsRoot();
@fuzzyfox
fuzzyfox / index.html
Last active August 29, 2015 13:56
Pen: simple CSS hexagon
<p>My improvement on CSS Hexagons, inspired by <a href="http://jtauber.github.io/articles/css-hexagon.html">James Tauber's CSS Hexagon Tutorial</a></p>
<span class="hex"></span>