Skip to content

Instantly share code, notes, and snippets.

View DimitarChristoff's full-sized avatar

Dimitar Christoff DimitarChristoff

View GitHub Profile
@DimitarChristoff
DimitarChristoff / doubleclick.js
Created May 30, 2012 09:07
pixel tracking ftw
;(function() {
var lazyLoadScript = function(url) {
// make sure the script being loaded does not do document.write and can be deferred.
var ns = document.createElement('script'),
s = document.getElementsByTagName('script')[0];
ns.type = 'text/javascript';
ns.async = true;
ns.src = url;
s.parentNode.insertBefore(ns, s);
@DimitarChristoff
DimitarChristoff / app.js
Created May 30, 2012 09:49
poor man's AMD and mootools
require.config({
baseUrl: 'scripts/',
paths: {
'text': 'lib/text',
'mustache': 'lib/mustache',
'mootools': 'lib/mootools-core',
'mootools-more': 'lib/mootools-more',
'router': 'lib/router',
'breadcrumb': 'modules/breadcrumb',
'settings': 'modules/settings',
@DimitarChristoff
DimitarChristoff / bootstrap-dropdown.js
Created May 30, 2012 13:43
bootstrap dropdown nicer
(function($) {
"use strict"; // jshint ;_;
/* DROPDOWN CLASS DEFINITION
* ========================= */
var toggle = '[data-toggle="dropdown"]',
Dropdown = function (element) {
var $el = $(element).on('click.dropdown.data-api', this.toggle);
(function(){
/*
---
description: DynamicTextarea
license: MIT-style
authors:
- Amadeus Demarzi (http://amadeusamade.us)
@DimitarChristoff
DimitarChristoff / breaking-buster-sinon-spy.js
Created June 20, 2012 15:39
circular references and .spy cause RangeError: Maximum call stack size exceeded
buster.testCase('breaking call stack when using circular references and spies', {
setUp: function() {
var A = function() {
this.collections = [];
}, B = function() {
this.models = [];
this.add = function(what) {
what.collections.push(this);
$.if = function(){
var truthy = 1;
for (var i = 0; i < arguments.length; i++){
if (!arguments[i]){
truthy = 0;
break;
}
}
<?php
/**
* proxy for getting json data via CURL
*/
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: application/json');
$url = $_REQUEST['url'];
@DimitarChristoff
DimitarChristoff / log.txt
Created July 10, 2012 10:44
npm test fails due to exit code of buster-test
> npm test
> [email protected] test /Users/dchristoff/projects/Epitome
> node_modules/.bin/buster-test
Firefox 13.0.1, OS X 10.7 (Lion): ................................................................................
...
9 test cases, 83 tests, 83 assertions, 0 failures, 0 errors, 0 timeouts
Finished in 0.852s
(function(exports) {
var Epitome = {};
typeof define == "function" && define.amd ? define("epitome", [], function() {
return Epitome
}) : typeof module == "object" ? module.exports = Epitome : exports.Epitome = Epitome
})(this), function(exports) {
var Epitome = typeof require == "function" ? require("./epitome") : exports.Epitome,
eq = Epitome.isEqual = function(a, b, stack) {
stack = stack || [];
if (a === b) return a !== 0 || 1 / a == 1 / b;