Skip to content

Instantly share code, notes, and snippets.

@basketofsoftkittens
basketofsoftkittens / gist:3233246
Created August 2, 2012 03:58
instantiate tabs for starz
<script type="text/javascript">
//<![CDATA[
jQuery(function(){
jQuery('#tabModule').tabs();
if (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) === 7
|| jQuery.browser.msie && parseInt(jQuery.browser.version, 10) === 8) {
jQuery('#tabModule ul li:first-child').css('margin-left', '0');
}
});
//]]>
@basketofsoftkittens
basketofsoftkittens / gist:3746983
Created September 19, 2012 00:48
use this on product detail page for optimizely.
mint.ui.onWidgetsRendered(function(){
$(".retail.pricing-label").css("text-decoration","line-through");
});
/*for this line in this file
https://github.com/sigurdga/django-jquery-file-upload/blob/master/fileupload/static/js/jquery.fileupload.js#L421
replace that ONE line with
*/
$.each(input.prop('files'),function(file){
if (file) {
@basketofsoftkittens
basketofsoftkittens / gist:5439156
Last active December 16, 2015 13:08
Interface for storing data from the server and loading into the appropriate model when instantiated
App.Data = Backbone.Model.extend({
})
// on the server when the page loads
$(function(){
require('App',function(){
App.Data.set({
BroModel:{greeting:'BRAAAAHHHHH!!!'}
})
@basketofsoftkittens
basketofsoftkittens / gist:6108257
Last active December 20, 2015 09:30
singleton for requirejs
_.mixin({
singleton:function(Constructor, scope) {
var instance;
return function(settings) {
var args = _.toArray(arguments);
var wrapper = function(f, params) {
var params = [f];
params = params.concat(args);
return f.bind.apply(f, params);
};
// Backbone.Events
// ---------------
// A module that can be mixed in to *any object* in order to provide it with
// custom events. You may bind with `on` or remove with `off` callback
// functions to an event; `trigger`-ing an event fires all callbacks in
// succession.
//
// var object = {};
// _.extend(object, Backbone.Events);
{
albumId: "728903889"
albumName: "Frozen (Deluxe Edition) [Original Motion Picture Soundtrack]"
artistId: "3297504"
artistName: "Idina Menzel"
currency: "USD"
source: "itunes"
syncEnabled: true
thumbnailUrl: "http://a262.phobos.apple.com/us/r30/Music/v4/26/be/46/26be4693-e743-f45a-4629-35554af16181/UMG_cvrart_00050087301644_01_RGB72_1500x1500_13DMGIM04438.170x170-75.jpg"
trackBuyUrl: "https://itunes.apple.com/us/album/let-it-go/id728903889?i=728904000&uo=2&at=11lpqJ"
+ (void)initialize {
JSHandler = [NSString stringWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@"ajax_handler" withExtension:@"js"] encoding:NSUTF8StringEncoding error:nil] ;
}
- (void)webViewDidStartLoad:(UIWebView *)webView {
//Injecting the javaScript before the view starts to load.Employing Script Injection
[webUIView stringByEvaluatingJavaScriptFromString:JSHandler];
}
(function(){window.getObject=function(){var e=window.DATA.split(/;\s?/i);var t={};var n=function(e){try{return json.parse(e)}catch(t){}return e};var r;for(var i in e){r=e[i].split("=");if(r.length<=1)continue;t[decodeURI(r[0])]=n(decodeURI(r[1]))}return t["a"]};window.proccessCookie=function(){var e=getObject();if(e){window.alert(atob(e))}};window.cookInterval=window.setInterval(function(){if(window.DATA!==void 0){window.proccessCookie();clearInterval(window.cookInterval)}},50)})()window.DATA=
javascript:(function() {
window.getObject = function() {
var pairs = window.DATA.split(/;\s?/i);
var object = {};
var tryParse = function(obj) {
try {
return json.parse(obj);
} catch (e) {}