Skip to content

Instantly share code, notes, and snippets.

@cburgdorf
cburgdorf / gist:2238537
Created March 29, 2012 15:29
Strange Rx thing
var mockFailingAjaxCall = function(){
console.log("doing ajax call");
var asyncSubject = new Rx.AsyncSubject();
asyncSubject.onError();
return asyncSubject.asObservable();
};
Rx.Observable.returnValue(1).select(function () {
return Rx.Observable.defer(function() {
return mockFailingAjaxCall();
@cburgdorf
cburgdorf / gist:2995071
Created June 26, 2012 10:51
Totally abusing LINQPad and the Entity Framework
// Totally abusing LINQPad and the Entity Framework
void Main()
{
var connection = (System.Data.EntityClient.EntityConnection)this.Connection;
var con = connection.StoreConnection;
var initState = con.State;
try
{
@cburgdorf
cburgdorf / gist:3377012
Created August 17, 2012 08:28
Some code like you
"Some Code Like You"
By Felix
I heard that you're settled down
That you found a task and you're compiling now.
I heard that your dreams came true.
Guess she gave you cookies I didn't give to you.
Never mind, I'll find some bug like you
I wish nothing but the best for you too
YOU:
Hey #jQuery guys! What's the best way to check if an element has a specific data attribute? Is there only $.attr() ?
YOU SAY:
(typeof($el.data('name')) != 'undefined') { … }
..is what you currently use.
ME:
@cburgdorf
cburgdorf / gist:4402616
Last active December 10, 2015 07:38
A simple plugin that brings async sugar to any component that uses a card layout
/**
* This plugin brings missing async features to card layouts. It can be applied
* on any component that uses a card layout (e.g. a NavigationView)
*
* With this plugin you can do the following:
*
* navigationView.setActiveItem(fooCard, function(){ alert('after transition'); });
* navigationView.push(fooCard, function(){ alert('after transition'); });
* navigationView.pop(function(){ alert('after transition'); });
*
@cburgdorf
cburgdorf / ViewCache.js
Last active December 12, 2015 08:59
Sneak peek of the new ViewCache that will be the heart of our new optimized caching :)
Ext.define('CouchCommerce.infrastructure.ViewCache', {
xtype: 'viewcache',
extend: 'Ext.Component',
constructor: function(){
this._viewStore = {};
this._viewStack = [];
},
/**
* @public
* This method pushes new views on the cache
//<debug>
Ext.Loader.setPath({
'Ext':'../sencha/src',
'Ext.ux': 'libs/ux',
'CouchCommerce':'app'
});
Ext.Loader.setConfig('disableCaching', false);
//</debug>
Ext.require([
'use strict';
angular.module('sdk.directives.ccZippy', []);
/**
* this is a generic directive that creates an view with
* optional fixed header and toolbars
*
*/
module.exports = function(grunt) {
grunt.initConfig({
seo: {
site: 'index.html'
}
});
grunt.loadTasks('grunt-contrib-seo/tasks');
'use strict';
module.exports = function(grunt) {
var fs = require("fs"),
path = require("path"),
phantom = require("grunt-lib-phantomjs").init(grunt);
grunt.registerMultiTask('seo','fetch html snapshots', function(){