Skip to content

Instantly share code, notes, and snippets.

View kaylarose's full-sized avatar

Kayla Rose kaylarose

View GitHub Profile
//This will patch the jquery.iviewer plugin to accept a post-zoom callback function
//http://github.com/can3p/iviewer/issues/issue/1
/**
* event is triggered when zoom value is changed
* @param int new zoom value
* @return boolean if false zoom action is aborted
**/
onZoom: null,
//begin patch
@kaylarose
kaylarose / RaphaelJSShapeDrawingApp.html
Created November 11, 2010 21:07
A Simple Vector Shape Drawing App with RaphaelJS and jQuery
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script src="http://yandex.st/raphael/1.5.2/raphael.min.js"></script>
<script>
/**
* A Simple Vector Shape Drawing App with RaphaelJS and jQuery
* copyright 2010 Kayla Rose Martin - Licensed under the MIT license
* Inspired by http://stackoverflow.com/questions/3582344/draw-a-connection-line-in-raphaeljs
**/
@kaylarose
kaylarose / ADebuggable_Soap_Client.php
Created February 8, 2011 23:01
Basic SOAP Client with Debugging Features and Dynamic API Method Invocation
/**
* Basic SOAP Debugging and Service Discovery Methods for Programming Against SOAP Services
*/
abstract class ADebuggable_Soap_Client extends SoapClient
{
protected $_cached_apis;
/**
* Output some useful info about this SoapClient Instnace or State
*/
public abstract function debug();
/* This is a linear gradient that will go from:
very light grey (#EEE) at the top,
to medium grey (#BBB) at the bottom
*/
.grey_gradient {
/* Graceful fallback for unsupported browsers */
background: #ccc;
/* Firefox 3.6+ */
background-image: -moz-linear-gradient(top, #eee, #bbb);
/* Webkit (Safari 4+, Chrome) */
@kaylarose
kaylarose / OctoStats.html
Created February 24, 2011 21:05
5-line GitHub API Client and Example of GitHub badge
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>untitled</title>
<meta name="generator" content="TextMate http://macromates.com/">
<meta name="author" content="WAVE Corp">
<!-- Date: 2011-02-24 -->
@kaylarose
kaylarose / HTML5_Psuedo-Streaming_Reproduciton.html
Created March 1, 2011 16:08
Reproduction of HTML5/Flash Fallback Streaming bug in Kaltura Player
<!DOCTYPE html>
<html>
<head>
<title>Simple video sample</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="http://html5.kaltura.org/js" ></script>
</head>
<body>
<video id="vid1" width="480" height="267" durationHint="02:32">
@kaylarose
kaylarose / Factory.php
Created March 18, 2011 17:32
KISS_Dynamic_Patterns
<?php
class Factory{
public static function create($name){
if(class_exists($name, TRUE)){
return new $name;
}else{
throw new IllegalArgumentException("$name is not an invalid or unknown type");
}
}
}
@kaylarose
kaylarose / gist:1683912
Created January 26, 2012 17:27
Function Composition in JS
// Elegant composition
// src: http://news.ycombinator.com/item?id=3512011
function compose(funcA, funcB){
return function(x, result, error){
// Data flows right-to-left over composition, so "do x, then do y"
// is written: "do y" o "do x"
funcB(x, function(x_){ funcA(x_, result, error) }, error);
}
}
@kaylarose
kaylarose / get_barcode_from_image.js
Created February 28, 2012 18:10 — forked from tbtlr/get_barcode_from_image.js
Barcode recognition with JavaScript - Demo: http://bit.ly/djvUoy
/*
* Copyright (c) 2010 Tobias Schneider
* This script is freely distributable under the terms of the MIT license.
*/
(function(){
var UPC_SET = {
"3211": '0',
"2221": '1',
"2122": '2',
@kaylarose
kaylarose / img_utils
Created July 31, 2012 19:12
ImageMagick Snippets
# Add 10px of transparency canvas to all PNGs in this dir - renamed padded-ORIGNAME.png
`convert *.png -matte -bordercolor none -border 10 -set filename:fname '%t' 'padded-%[filename:fname].png'`
# Compress JPEGs at desired quality (1-100)
`convert *.jpg -quality 85 -set filename:fname '%t' 'compressed-%[filename:fname].jpg'`