Skip to content

Instantly share code, notes, and snippets.

View AubreyHewes's full-sized avatar
💭
I may be slow to respond.

Aubrey AubreyHewes

💭
I may be slow to respond.
View GitHub Profile
@jirutka
jirutka / rules-both.iptables
Created September 18, 2012 12:42
Basic iptables template for ordinary servers (both IPv4 and IPv6)
###############################################################################
# The MIT License
#
# Copyright 2012-2014 Jakub Jirutka <jakub@jirutka.cz>.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@kingschnulli
kingschnulli / SVGText.js
Created June 18, 2013 13:26
SVGText for fabric.js
fabric.SVGText = fabric.util.createClass(fabric.Object, {
type :'text-block',
text :'',
fontSize :14,
color :undefined,
lineColors :undefined,
selectedLine:0,
realWidth :0,
realHeight :0,
@larrybotha
larrybotha / A.markdown
Last active February 7, 2024 15:20
Fix SVGs not scaling in IE9, IE10, and IE11

Fix SVG in <img> tags not scaling in IE9, IE10, IE11

IE9, IE10, and IE11 don't properly scale SVG files added with img tags when viewBox, width and height attributes are specified. View this codepen on the different browsers.

Image heights will not scale when the images are inside containers narrower than image widths. This can be resolved in 2 ways.

Use sed in bash to remove width and height attributes in SVG files

As per this answer on Stackoverflow, the issue can be resolved by removing just the width and height attributes.

@hSATAC
hSATAC / jenkins_build_docker.bash
Created May 27, 2014 10:52
Docker run does not pass exit code back to jenkins. This is a workaround for that.
docker build --rm -t $JOB_NAME/$BUILD_NUMBER .
docker run $JOB_NAME/$BUILD_NUMBER | perl -pe '/Failed examples:/ && `echo "fail" > docker-tests-failed`'
if [ ! -f docker-tests-failed ]; then
echo -e "No docker-tests-failed file. Apparently tests passed."
else
echo -e "docker-tests-failed file found, so build failed."
rm docker-tests-failed
exit 1
fi
/**
* Console.log with call location and grouping to reduce log noise.
* Apply directly to code once.
*
* Original: http://remysharp.com/2014/05/23/where-is-that-console-log/
*/
var groupable = typeof console.groupCollapsed !== 'undefined';
['log', 'warn'].forEach(function(method) {
var old = console[method];
console[method] = function() {
@AubreyHewes
AubreyHewes / phpstorm-eap-update
Last active May 3, 2021 13:25
Update/Install the latest PhpStorm EAP automatically (add to external tools)
#!/usr/bin/env bash
#######################################################################################################################
#
# Updates/Install the latest PhpStorm EAP
#
# --------------------------------------------------------------------------------------------------------------------
#
# * Retrieves the current version from the EAP wiki
# * If the new version is not the current version (based on symlink to PhpStorm) then updates
# * Creates a symlink from versioned folder to PhpStorm
@tobek
tobek / get-image-urls.js
Last active May 25, 2024 23:46
Save images from chrome inspector/dev tools network tab
/* open up chrome dev tools (Menu > More tools > Developer tools)
* go to network tab, refresh the page, wait for images to load (on some sites you may have to scroll down to the images for them to start loading)
* right click/ctrl click on any entry in the network log, select Copy > Copy All as HAR
* open up JS console and enter: var har = [paste]
* (pasting could take a while if there's a lot of requests)
* paste the following JS code into the console
* copy the output, paste into a text file
* open up a terminal in same directory as text file, then: wget -i [that file]
*/
@davidsonfellipe
davidsonfellipe / pagespeed.md
Last active August 31, 2015 18:01
Workaround for pagespeed on Chrome

PageSpeed Insights for Google Chrome has been deprecated. Please use the online version of PageSpeed Insights.

Workaround by @kiquenet

For Google Page Speed extension:

Maybe any partner in your company has installed the extension. Then do this::

Open chrome://version/ and look for Profile Path:

@hugochinchilla
hugochinchilla / slack_munin.sh
Last active July 7, 2023 14:53 — forked from anarchivist/slack_munin.sh
Slack notification script for Munin
#!/bin/bash
# Slack notification script for Munin
# Mark Matienzo (@anarchivist)
#
# To use:
# 1) Create a new incoming webhook for Slack
# 2) Edit the configuration variables that start with "SLACK_" below
# 3) Add the following to your munin configuration:
#
@tomhazledine
tomhazledine / calculate_reading_time.php
Created November 16, 2016 08:30
Calculate Reading Time (for WordPress content)
<?php
/**
* READING TIME
*
* Calculate an approximate reading-time for a post.
*
* @param string $content The content to be measured.
* @return integer Reading-time in seconds.
*/
function reading_time( $content ) {