Skip to content

Instantly share code, notes, and snippets.

View loadedsith's full-sized avatar

Graham P Heath loadedsith

View GitHub Profile
@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 / twitter sender
Last active December 14, 2015 16:19
processing twitter sender
/*
Just a simple Processing and Twitter thingy majiggy
RobotGrrl.com
Code licensed under:
CC-BY
*/
@loadedsith
loadedsith / NoiseFeed.pde
Created March 9, 2013 19:49
A quick processing sketch demonstrating Perlin Noise and basic object oriented programming.
int starCount=0;
fallingStar[] stars;
int size = 10;
float seed = 0.0;
void setup() {
size(480, 480);
stars = new fallingStar[1];
stars[0] = new fallingStar(10,10);
noStroke();
@loadedsith
loadedsith / gist:5126036
Created March 9, 2013 22:25
Processing Twitter Stream Tracker
import processing.core.*;
import twitter4j.*;
import twitter4j.conf.ConfigurationBuilder;
private static final long serialVersionUID = 1L;
private static TwitterStream tw;
@loadedsith
loadedsith / gist:5931257
Created July 5, 2013 02:19
fold guides theme
{ name = 'Alternating Tabs';
scope = 'meta.even-tab';
settings = {
fontStyle = 'foldGuide';
foreground = '#353535';
};
},
{ name = 'Alternating Tabs';
scope = 'meta.odd-tab';
@loadedsith
loadedsith / jquery.getParam.js
Last active December 19, 2015 21:39 — forked from lunaroja/jquery.getParam.js
Jquery / Zepto agnostic plugin version of jquery.getParam() for grabbing the parameters out of the uri
;(function($){
$.extend($, {
getParam: function(n,u) {
if(!u) var u = window.location.search;
var match = RegExp('[?&]' + n + '=([^&]*)').exec(u);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}
})
})(window.Zepto || window.jQuery)
# Scan it for all instances of (unescaped) <rules>
# Each match will be an array containing the portion of string before
# the <rule>; and the <rule> itself (which may be empty on the last match)
choice.scan(Regexp.new("/(.*?(?<!\\)(?:\\\\)*)(<.*?>|$)/",nil,"u")) do |match|
local_res << match[0]
unless match[1].empty?
local_res << invoke(match[1].match(/<(.*?)>/)[1].to_sym)
end
end
@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 / scrollByAnimated.js
Last active June 13, 2019 17:28
scrollByAnimated(scrollY) Pure javascript
scrollByAnimated = function(scrollY, duration){
var startTime = new Date().getTime();
var startY = window.scrollY;
var endY = startY + scrollY;
var currentY = startY;
var directionY = scrollY > 0 ? 'down' : 'up';
var animationComplete;
var count = 0;
@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.