Skip to content

Instantly share code, notes, and snippets.

View loadedsith's full-sized avatar

Graham P Heath loadedsith

View GitHub Profile
@loadedsith
loadedsith / photoshopToSpritesheetScripts.js
Created May 30, 2014 20:15
Photoshop to spritesheet scripts (JS and SCSS)
//You have to run the script from the ExtendScript tool (Applications/Utilities/Adobe Utilities-CS6/ExtendScript Toolkit CS6/ExtendScript Toolkit.app)
/*JS*/
var counts = app.activeDocument.countItems;
var NumberOfCounts = counts.length;
var count = 0;
$.write("[");
while(count < NumberOfCounts ){
var newPos ={};
@loadedsith
loadedsith / gist:780068e5aac5dff82acd
Last active August 29, 2015 14:14
gcode for phone stand
/* [Basic] */
// Devices longest dimention.
device_height = 139;
// Second Longest Dimention
device_width = 67;
// Amount of "tray" for the device . Distance between bottom of device well and top of device well. Tip: Increase this to reduce angle between device width/height and device height/width offsets, or set offsets to 0 to get no overhang at all.
device_depth = 5;
//Modify the device tray opening height relative to its base height.
@loadedsith
loadedsith / stackEgg.js
Last active August 29, 2015 14:18
StackEgg Automation Script
var clickButton = function(actionElement) {
console.log('actionElement', actionElement);
$(actionElement).click();
}
var defaultStats = {
'questions': {
'id': '#egg-stat-questions',
'action':clickButton.bind(null,'#egg-action-ask button')
},
@loadedsith
loadedsith / SassMeister-input.scss
Last active August 29, 2015 14:19
Generated by SassMeister.com.
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
$ru: (
name: 'ru',
font-size: 12px,
font-family: "Helvetica",
letter-spacing: 1px
);
@loadedsith
loadedsith / gist:503575ad041f873bdcb5
Created April 23, 2015 19:24
Toggle html[lang=___] script
var DEFAULT_VALUE = 'ru-ru';
function toggle (language) {
language = (typeof language === 'undefined') ? DEFAULT_VALUE : language;
var currentLang = $('html').attr('lang');
if (currentLang === 'en') {
$('html').attr('lang', language);
}else if (currentLang === language) {
$('html').attr('lang', 'en');
} else {
@loadedsith
loadedsith / gist:a5d628856208cb5b7e3b
Last active August 29, 2015 14:20
my .bash_profile
alias c=clear
function gulp() { clear; /Users/grahamh/npm/bin/gulp "$@" ;}
#alias mate='open -a TextMate.app'
export NVM_DIR="/Users/grahamh/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
export PATH=/Users/grahamh/.npm/bin:$PATH
export PATH=/Users/grahamh/npm/bin:$PATH
@loadedsith
loadedsith / RDemo.r
Created August 20, 2015 04:50
TextMate R language grammar demo with number tick number plus for stack
#' This is a special R script which can be used to generate a report. You can
#' write normal text in roxygen comments.
#'
#' First we set up some options (you do not have to do this):
#+ setup, include=FALSE
library(knitr)
opts_chunk$set(fig.path = 'figure/silk-')
#' The report begins here.
#!/usr/bin/env bash
# before:
# $> tree .
# .
#
# 0 directories, 0 files````
#
#
# after:
# $> tree .
@loadedsith
loadedsith / php_serial.class.php
Created August 27, 2012 05:27 — forked from ahutchings/php_serial.class.php
PHP Serial Port Control Class by Rémy Sanchez with Modifications for OS X (Updated for 10.8 Mountain Lion, byGPH)
<?php
define ("SERIAL_DEVICE_NOTSET", 0);
define ("SERIAL_DEVICE_SET", 1);
define ("SERIAL_DEVICE_OPENED", 2);
/**
* Serial port control class
*
* THIS PROGRAM COMES WITH ABSOLUTELY NO WARANTIES !
* USE IT AT YOUR OWN RISKS !
@loadedsith
loadedsith / emoji-short.coffee
Last active November 7, 2015 00:19
Hubot Emoji Script w/ Specific emoji blocking
# Description:
# emoji.coffee - Replaces :text: or text with emojis.
# Great for IRC or anywhere not already emojified.
#
# Dependencies:
# None
#
# Configuration:
# None
#