Skip to content

Instantly share code, notes, and snippets.

# EditorConfig is awesome: http://EditorConfig.org
root = true
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
//#target photoshop
app.bringToFront();
activeDocument.suspendHistory('Raster SOs', 'main()');
function main() {
if(!documents.length) return;
selectAllLayers();
var selectedLayers = getSelectedLayersIdx();
// Get the bounding boxes and delta
var beforeFormBounds = beforeForm.getBoundingClientRect();
var formBounds = form.getBoundingClientRect();
var formDelta = formBounds.top - beforeFormBounds.top;
var beforeFormDelta = beforeFormBounds.top - formBounds.top;
// Move the dom node
this.insertBefore(form, beforeForm);
this._reIndexForms();
this.updateOrdering();
@andrewebdev
andrewebdev / bucket
Created April 13, 2016 15:03
Uses sockets to open connections to bitbucket
#!/bin/bash
case "$1" in
'start') echo "Starting SSH tunnel ..."
ssh -fTN git@bitbucket.org
;;
'check') echo "Checking if tunnel is active ..."
ssh -O check git@bitbucket.org
;;
$color-grey-slight: #fafafa;
$color-grey-light: #e5e5e5;
$color-grey-medlight: #e1e1e1;
$color-grey-medlight2: #bdbdbd;
$color-grey-medium: #898989;
$color-grey-dark: #393939;
$color-grey-dark2: #444444;
$color-grey-vdark: #2e2e2e;
$color-green-dark: #638d28;
--color-base1: #010714;
--color-base2: #fafafa;
--color-primary1: #D36000;
--color-primary2: #FF7E13;
--color-Primary3: #FF7400;
--color-primary4: #AA4D00;
--color-primary5: #7C3800;
--color-secondary1: #D38D00;
# The long, slightly incorrect method...
def looper(count, depth, *args):
"""
No this does not allow you to go back in time
@param count: number of iterations per loop
@param depth: number of loops
"""
for i in range(count):
if depth > 0:
def get_template_names(self, **kwargs):
if self.template_name:
return self.template_name
return self.page.get_template()
import os
import base64
from subprocess import call
from django import http
from django.conf import settings
from django_seo_js.backends import SEOBackendBase
SITE_CONF = getattr(settings, 'SITE_CONF')
@andrewebdev
andrewebdev / gist:6194588
Last active December 20, 2015 20:59
Django: time conversion to drop the miliseconds
def format_date_for_sforce(timestamp):
"""
Returns a datetime formatted as 2012-02-15T19:03:32-0800
"""
if not timestamp:
return timestamp
total_seconds = timestamp.utcoffset().total_seconds()
minutes, seconds = divmod(total_seconds, 60)
hours, minutes = divmod(minutes, 60)