Skip to content

Instantly share code, notes, and snippets.

View jonlow's full-sized avatar
💭
On the toilet

Jon Low jonlow

💭
On the toilet
View GitHub Profile
@jonlow
jonlow / OpenWithSublimeText2.bat
Created June 26, 2014 02:12 — forked from mrchief/LICENSE.md
Right click and open a folder in Sublime
@echo off
SET st2Path=C:\Program Files\Sublime Text 2\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f
@jonlow
jonlow / iePngFix.css
Last active August 29, 2015 14:03
Fixes black speckle issue for PNG's in old IE (8 and down)
.png-trans img {
filter: progid:DXImageTransform.Microsoft.gradient(
startColorstr=#00FFFFFF, endColorstr=#00FFFFFF
);
/* If the above code doesn't work for IE7, try the below code instead. */
/*background: transparent;
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF)";
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);
@jonlow
jonlow / webFontsLocal.md
Last active August 29, 2015 14:03
Google Web Fonts working locally in IE8+

##The Issue

Referencing web fonts that are hosted on Google Fonts doesn't always work. This could be because of:

  • inconsistent browser security permissions (IE8 is a soul crusher).
  • referencing the fonts from within an iFrame.
  • domain restrictions on your production server.

You can get around these issues by hosting the fonts locally in your project

@jonlow
jonlow / rubyProxyWindow.md
Last active August 29, 2015 14:03
Use ruby on windows behind a proxy

To install ruby gems from the command line behind a proxy in windows, you need to set a HTTP_PROXY environment variable.

@jonlow
jonlow / nodeSetupProxy.md
Last active August 29, 2015 14:03
How to setup Node.js and Npm behind a corporate web proxy
# Set the URLs to your own proxy
npm config set proxy http://t2proxy.talent2.corp:8080
npm config set https-proxy http://t2proxy.talent2.corp:8080

View more details here

@jonlow
jonlow / cssPngSelector.css
Last active August 29, 2015 14:03
CSS selector to target all PNG images (works all the way back to IE7)
img[src$=".png"] {
border: 5px solid red;
}
@jonlow
jonlow / simplePreloadImages.js
Created July 4, 2014 06:00
Preload an array of images into browser cache
function preloadImages(array) {
if (!preloadedImages.list) {
preloadedImages.list = [];
}
for (var i = 0; i < array.length; i++) {
var img = new Image();
img.src = array[i];
preloadedImages.list.push(img);
}
}

To ensure your local apache websites bypass a proxy you may be on, you need to add a range of ipaddresses/addresses as an exclusion list.

In the below example I am enabling all .dev websites and anything 172.18.9.* IP range

@jonlow
jonlow / httpd.conf
Created July 8, 2014 05:00
Basic Apache 2.2 httpd.conf with acccess to "c:\dev" folder + virtualhosts
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
@jonlow
jonlow / imageButtonText.css
Last active August 29, 2015 14:03
Overlay an image button (with text) on text, so that when you turn images off it is still accessible.
a.backButton { /* Obviously change the class to whatever you want*/
display: block;
width: 50px; /* Width of the image */
position: relative;
}
a.backButton img {
position: absolute;
top: 0;
left: 0;