Skip to content

Instantly share code, notes, and snippets.

View funkjedi's full-sized avatar

Tim Robertson funkjedi

View GitHub Profile
@funkjedi
funkjedi / marionette.handlebars.js
Last active April 5, 2024 14:29
Integrates Handlebars with Marionette. First attempts to load pre-compiled templates, then by selector, and finally via XHR.
/**
Usage: Just include this script after Marionette and Handlebars loading
IF you use require.js add script to shim and describe it in the requirements
*/
(function(Handlebars, Marionette) {
Marionette.Handlebars = {
path: 'templates/',
extension: '.handlebars'
};
@funkjedi
funkjedi / globstar.php
Created January 21, 2017 22:38
Extended glob() to support double star ** (globstar) wildcard.
<?php
function globstar($pattern, $flags = 0) {
if (stripos($pattern, '**') === false) {
$files = glob($pattern, $flags);
}
else {
$position = stripos($pattern, '**');
$rootPattern = substr($pattern, 0, $position - 1);
$restPattern = substr($pattern, $position + 2);
@funkjedi
funkjedi / bookmarklet.js
Last active September 18, 2023 02:03
Simple YouTube bookmarklet that hides everything and makes the video full size
(function() {
class YT_Max {
constructor() {
this.maximized = false;
this.resizeHander = (event => {
this.setStyles();
});
}
@funkjedi
funkjedi / remove_ufw_chains.sh
Created July 11, 2017 18:40
Remove UFW chains
#!/bin/bash
for ufw in `iptables -L | grep 'Chain ufw' | awk '{ print $2 }'`; do iptables -F $ufw; done
for ufw in `iptables -L | grep 'Chain ufw' | awk '{ print $2 }'`; do
iptables -D INPUT -j $ufw
iptables -D FORWARD -j $ufw
iptables -D OUTPUT -j $ufw
done
@funkjedi
funkjedi / cleaner-pipefy.user.css
Created June 12, 2020 18:43
Userstyle for Pipefy
@import "//fonts.googleapis.com/css?family=Lato";
.pp-card .pp-card-content p { font-weight: normal; line-height: 1.2; }
.pp-phases-item.pp-phase-done,
.pp-card .pp-card-footer,
.pp-card .pp-card-footer .pp-card-users,
.pp-open-card .pp-empty-state-container { display:none; }
@funkjedi
funkjedi / 217-1.js
Last active October 2, 2018 19:09
Code snippets from blog
errorOccurred = lastErrorOccurred = new Date().getTime();
_back = function(h) {
if (_backOk) {
if (_backCallback) {
_backCallback();
_backCallback = null;
}
var hh = parseInt(h);
var m = $.browser.netscape ? 2 : $.browser.msie ? 3 : 7;
if (hh > m) {
@funkjedi
funkjedi / tw-bootstrap.css
Created January 27, 2017 23:25
Twitter Bootstrap v3.3.7 (Namespaced)
.tw-bootstrap {
/*!
* Bootstrap v3.3.7 (http://getbootstrap.com)
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */
/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */
/*# sourceMappingURL=bootstrap.css.map */
}
@funkjedi
funkjedi / 474.php
Last active January 17, 2017 18:26
Display Information About the Registered Actions and Filters in Wordpress
<?php
function wp_filter_dump($name) {
global $wp_filter;
$handlers = array();
if (!isset($wp_filter[$name])) {
return $handlers;
}
@funkjedi
funkjedi / gist:5675336
Created May 30, 2013 02:07
Super simple super tiny ajax function
function xhr(url, post) {
var req = window.ActiveXObject
? new ActiveXObject('Microsoft.XMLHTTP')
: new XMLHttpRequest();
if (post) {
req.open("POST", url, true);
req.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
req.setRequestHeader('Connection', 'close');
req.send(post);
@funkjedi
funkjedi / gist:4353932
Created December 21, 2012 16:44
Bookmarklet for obtaining hi-res image previews from iStock
javascript:(function(){zoomFile.size=zoomFile.maxSize;top.location.href=zoomFile.mGetImageURL()})();