Skip to content

Instantly share code, notes, and snippets.

View kaylarose's full-sized avatar

Kayla Rose kaylarose

View GitHub Profile
@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 / notes
Last active December 24, 2015 18:19
Cocoapods Cheatsheet
# Cocoapods Notes
## For XCode 5 Dev Preview on Mavericks
If your dynamic frameworks in the Pods project are getting linked to OSX Frameworks instead of iOS, you can try reverting to an earlier version of Cocoapods (0.24.0)
- This is more of an XCode UI bug, than a real build problem, but at this point in time there is no work around in Cocoapods. Original Source: https://github.com/CocoaPods/CocoaPods/issues/1420#issuecomment-25561488
@kaylarose
kaylarose / gist:6072294
Created July 24, 2013 16:48
Force Update Safari to Safari 6 (bypass Software Updater GUI)
curl $(strings /System/Library/PrivateFrameworks/SoftwareUpdate.framework/SoftwareUpdate | grep http | grep sucatalog) | grep Safari6 | grep pkg
@kaylarose
kaylarose / linked_key.py
Last active December 18, 2015 18:39
Google App Engine NDB Snippets
# Creates a back reference to Unknown kinds in a one-to-many model (from Guido Van Rossum)
# Source: http://stackoverflow.com/questions/10731433/following-backreferences-of-unknown-kinds-in-ndb
class LinkedKeyProperty(ndb.KeyProperty):
def _fix_up(self, cls, code_name):
super(LinkedKeyProperty, self)._fix_up(cls, code_name)
modelclass = ndb.Model._kind_map[self._kind]
collection_name = '%s_ref_%s_to_%s' % (cls.__name__,
code_name,
modelclass.__name__)
setattr(modelclass, collection_name, (cls, self))
@kaylarose
kaylarose / rdio_playlist_export.js
Created August 16, 2012 21:05
Bookmarklet to Export Rdio Playlist (Artist=>Track) in csv format
javascript:(function() {
var bookmarklet = {
bootstrap: function() {
var self = this;
if (!window.jQuery) {
var script = document.createElement("script");
script.src = "http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js";
script.async = true;
script.type = "text/javascript";
script.onload = function() { self.parse(); };
@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'`
@kaylarose
kaylarose / get_barcode_from_image.js
Created February 28, 2012 18:10 — forked from tobitailor/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 / 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 / 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 / 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">