Skip to content

Instantly share code, notes, and snippets.

View juliankrispel's full-sized avatar

Julian Krispel juliankrispel

View GitHub Profile
@juliankrispel
juliankrispel / deepclone.js
Last active August 29, 2015 14:02
a little deep clone function
var clone = function(thing){
switch(is(thing)){
case 'object':
var newobj = {};
for (var key in thing){
newobj[key] = clone(thing[key]);
}
return newobj;
case 'array':

Date: [date]

Between us [company name] and you [customer name].

Summary:

In short; neither of us will share any confidential information about each-other, by any means, with anyone else.

What’s confidential information?

@juliankrispel
juliankrispel / knockout-template-function.js
Created November 3, 2014 10:53
knockout.js component template function
// Add component
var inputComponentLoader = {
loadComponent: function(name, config, callback) {
if(u.isType(config.template, 'function')){
var template = ko.utils.parseHtmlFragment(config.template(config));
callback({
template: template,
createViewModel: createViewModelForInput
});
}else{
@juliankrispel
juliankrispel / rainforest-follow.js
Last active August 29, 2015 14:13
rainforest test
// Only works on letsrevolutionizetesting.com/challenge since CORS
// is disabled and jquery is included on that page
var getRecursive = function(url){
return $.ajax({url: url, dataType: 'json'})
.then(function(res){
if(res.hasOwnProperty('follow')){
return getRecursive(res.follow);
}else{
return res;
var express = require('express');
var app = express();
var request = require('request');
var protocol = 'https';
var port = 5000;
var _ = require('lodash');
var path = require('path');
var proxyUrl = 'app.rnfrstqa.com';
var makeUrl = function(url){
@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'
});
});
@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 / gist:4557898
Created January 17, 2013 17:45
Sass Loop for generating generic helpers
$x: 2;
$classnames: m, p;
$rulenames: margin, padding;
@while $x > 0{
$classname: nth($classnames, $x);
$rulename: nth($rulenames, $x);
$i: 4;
$a: (-top, -right, -bottom, -left);
$b: (-t, -r, -b, -l);
@juliankrispel
juliankrispel / gist:4564177
Created January 18, 2013 12:04
Magento - Get Handles (If you're not sure what tag it is)
<?php print_r($this->getLayout()->getUpdate()->getHandles()) ?>
@juliankrispel
juliankrispel / gist:4588586
Last active December 11, 2015 10:39
Wordpress snippets
<?php
/* Registering Post Types */
add_action( 'init', 'create_post_type' );
function create_post_type() {
register_post_type( 'acme_product',
array(
'labels' => array(
'name' => __( 'Slides' ),