Skip to content

Instantly share code, notes, and snippets.

/*
* Layers to SVG - layers_export.jsx
* @version 0.1.1
* Improved PageItem selection, which fixed centering
*
* @author Anton Ball
* @author Timothy Groves
* Exports all layers to SVG Files
* I didn't want every layer in the SVG file so it first creates a new document
* and one by one copies each layer to that new document while exporting it out
@gwa
gwa / gist:9267964
Created February 28, 2014 09:23
SublimeText run project grunt file as build.
"build_systems": [
{
"name": "grunt: default",
"cmd": ["grunt", "--no-color"],
"path": "/usr/local/bin",
"variants": [
{
"name": "grunt: cssmin",
"cmd": ["grunt", "--no-color", "cssmin"],
"path": "/usr/local/bin"
@gwa
gwa / gist:9188532
Created February 24, 2014 13:35
Prevent HTTP access to .svn folders
RewriteEngine On
RewriteRule ^(.*/)?\.svn/ - [F,L]
ErrorDocument 403 "Access Forbidden"
@gwa
gwa / gist:9074853
Created February 18, 2014 16:54
IE8 background PNG alpha hack
#demo {
background:url(ie8-logo.png) 0 0 no-repeat;
filter: progid:DXImageTransform.Microsoft.gradient(
startColorstr=#00FFFFFF, endColorstr=#00FFFFFF
);
}
@gwa
gwa / gist:8864420
Created February 7, 2014 15:06
JavaScript variable assign in a conditional
var m = '12';
// conditional needs a clause, not just an assignment, so compare to null to see if a match Array is returned.
if ((m = value.match(/^([\d]+)$/)) != null) {
return parseInt(m[1], 10);
}
@gwa
gwa / gist:8803319
Last active June 16, 2017 17:41
Bash one-liner to open sublime project in current directory from the command line.
# Add this to your ~/.profile to open the sublime project file in the current directory using `sublp` without any arguments.
# Note: `subl` ust be in your PATH.
#
# Usage: Navigate to folder containing project file. Type `sublp` and hit enter.
#
# Thanks to http://www.reddit.com/user/execrator for the hint!
#
alias sublp='subl --project *.sublime-project'
@gwa
gwa / gist:8296080
Created January 7, 2014 08:07
Check if a jQuery plugin (e.g. colorbox) is loaded.
function _initColorbox()
{
// return if colorbox not loaded
if (!jQuery().colorbox) {
return;
}
$(".selector").colorbox({});
}
@gwa
gwa / gist:8053245
Created December 20, 2013 10:58
Check if a jQuery plugin is loaded/available
if (!jQuery().pluginName) {
return;
}
// do something with the plugin here
@gwa
gwa / gist:7408858
Created November 11, 2013 06:33
Unix disk usage
#!/bin/sh
echo "==============="
echo "svn disk usage:"
du -sh /var/svn
echo "==============="
echo "git disk usage"
du -sh /var/git
echo "==============="
@gwa
gwa / gist:7332694
Last active December 27, 2015 13:19
iframe height change listener
// in parent document
// no jQuery required
(function () {
var
ifr = document.getElementById('iframeid'),
vpadding = 50;
window.addEventListener(
"message",
function (ev) {
var d=ev.data.split(':'), k=d[0], v=d[1];