Skip to content

Instantly share code, notes, and snippets.

View juliankrispel's full-sized avatar

Julian Krispel juliankrispel

View GitHub Profile
@juliankrispel
juliankrispel / gist:4160762
Created November 28, 2012 12:07
ie7 cross domain ajax request
if ($.browser.msie && window.XDomainRequest && $.browser.version.toString().indexOf('7') == 0) {
// Use Microsoft XDR
var xdr = new XDomainRequest();
xdr.open("get", url);
xdr.onload = function () {
var JSON = jQuery.parseJSON(xdr.responseText);
if (JSON == null || typeof (JSON) == 'undefined')
{
JSON = jQuery.parseJSON(data.firstChild.textContent);
}
@juliankrispel
juliankrispel / jquery.textfill.js
Created October 24, 2012 10:10
jQuery Plugin to resize text to fit container
(function($) {
$.fn.textfill = function(maxFontSize) {
maxFontSize = parseInt(maxFontSize, 10);
return this.each(function(){
var ourText = $("span", this);
function resizefont(){
var parent = ourText.parent(),
maxHeight = parent.height(),
maxWidth = parent.width(),
fontSize = parseInt(ourText.css("fontSize"), 10),
@juliankrispel
juliankrispel / titanium global events
Created January 23, 2012 15:48
Append an event to global app object / This is great for linking events across modules
button.addEventListener("click", function() {
Ti.App.fireEvent("app:updateData", {
field1: 'your',
field2: 'new',
field3: 'data'
});
});