Skip to content

Instantly share code, notes, and snippets.

@psebborn
psebborn / countCSSRules.js
Last active April 25, 2023 11:43
Count the number of rules and selectors for CSS files on the page. Flags up the >4096 threshold that confuses IE
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {
@kconragan
kconragan / keyrepeat.shell
Last active December 4, 2023 03:40
Enable key repeat in Apple Lion for Sublime Text in Vim mode
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
@colinmollenhour
colinmollenhour / cleanCache.php
Created May 17, 2012 00:50
Simplified cache cleaning script for production updates.
<?php
/**
* Set global/skip_process_modules_updates to '1' in app/etc/local.xml and
* then use this script to apply updates and refresh the config cache without
* causing a stampede on the config cache.
*
* @author Colin Mollenhour
*/
umask(0);
ini_set('memory_limit','512M');
@pfulton
pfulton / webkit-svg-heightfix.js
Created December 11, 2012 15:31
Webkit SVG height bugfix
// jQuery fix for Webkit SVG height bug.
// Documented here: https://bugs.webkit.org/show_bug.cgi?id=82489 & http://www.brichards.co.uk/blog/webkit-svg-height-bug-workaround
// Found via: http://stackoverflow.com/questions/7570917/svg-height-incorrectly-calculated-in-webkit-browsers
function fixWebkitHeightBug(){
var svgW = 658;
var svgH = 500;
var curSVGW = $('#svg-container').width();
var newSVGH = heightInRatio(svgH,svgW,curSVGW);
@chrisyip
chrisyip / vagrant-lamp.sh
Created May 8, 2013 11:58
Vagrant shell script for LAMP.
#!/usr/bin/env bash
apt-get update
echo mysql-server-5.5 mysql-server/root_password password PASSWORD | debconf-set-selections
echo mysql-server-5.5 mysql-server/root_password_again password PASSWORD | debconf-set-selections
apt-get install -y mysql-common mysql-server mysql-client
apt-get install -y apache2
@colinmollenhour
colinmollenhour / mysql_monitor.sh
Last active March 6, 2019 02:03
MySQL Monitor (like 'redis-cli MONITOR')
#!/bin/bash
#
# Monitor MySQL queries
# @author Colin Mollenhour
set -e
mysql="mysql"
test="test"
bash="bash"
@nicolashery
nicolashery / solarized-dark.css
Last active March 25, 2022 08:38 — forked from scotu/solarized.css
Solarized theme stylesheets for Jekyll and Pygments
/* Solarized Dark
For use with Jekyll and Pygments
http://ethanschoonover.com/solarized
SOLARIZED HEX ROLE
--------- -------- ------------------------------------------
base03 #002b36 background
base01 #586e75 comments / secondary content
@tegansnyder
tegansnyder / Magento-Solr-Setup-Guide.md
Last active December 3, 2018 15:08
SOLR setup script for Magento multi-core using default Jetty servlet

This guide assumes you are on Centos or a Redhat / Fedora system.

install Java JDK

sudo yum remove java
sudo yum install java-1.7.0-openjdk
sudo yum install java-1.7.0-openjdk-devel

# download Solr
cd ~/
@lukaskuzmiak
lukaskuzmiak / php_xxe_tester.php
Created August 20, 2014 00:45
PHP XXE tester
<?php
// Extended tester from ezimuel (https://gist.github.com/ezimuel/9135151)
// The libxml entity loader is disabled by default
// even setting the libxml_disable_entity_loader to false doesn't works!
//
// @see http://uk3.php.net/manual/en/function.libxml-disable-entity-loader.php
// @see http://stackoverflow.com/a/10213239
// @see https://stackoverflow.com/questions/24117700
$dir = __DIR__;
@davefreiman
davefreiman / rewrites_output
Created April 19, 2015 19:46
Output of script that scanned ~6000 Magento Connect extensions for all their listed rewrites - with help from triplecheck.io
{
"blocks":{
"sales_order_grid":110,
"sales_order_view":67,
"html_head":55,
"comment":51,
"catalog_product_grid":38,
"product_view":34,
"onepage":32,
"onepage_payment_methods":30,