Skip to content

Instantly share code, notes, and snippets.

@knalli
knalli / steal-example.js
Created July 4, 2012 19:27
Einfaches StealJS Beispiel
steal('jquery').then(function(){
$(document).find('title').text('Hello World');
});
@knalli
knalli / steal-example.coffee
Created July 4, 2012 19:28
Einfaches Steal-Beispiel (CoffeeScript)
steal('jquery').then -> $(document).find('title').text 'Hello World'
@knalli
knalli / jso.xml
Created August 12, 2012 10:42
Example for a JSO configuration file
<jso>
<!-- Ext JS 3.4 (Development) -->
<group name="extjs-devl">
<js>/resources/ext-3.4.0/adapter/ext/ext-base-debug.js</js>
<js>/resources/ext-3.4.0/ext-all-debug.js</js>
<js>/resources/ext-3.4.0/src/debug.js</js>
</group>
<!-- Ext JS 3.4 (Production) -->
<group name="extjs-prod">
<js>/resources/ext-3.4.0/adapter/ext/ext-base.js</js>
@knalli
knalli / example1.jsp
Created August 12, 2012 10:47
JSO Exploded
<jso:include exploded="true" groupNames="app-prod"></jso:include>
@knalli
knalli / uuid.js
Created December 31, 2012 15:40
Create an UUID in JavaScript
var buildUUID = function(bits) {
var CHARS, i, rand, result, _i;
CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ012345678900';
result = '';
while (bits > 0) {
rand = Math.floor(Math.random() * 0x100000000);
for (i = _i = 26; _i > 0; i = _i += -6) {
result += CHARS[0x3F & rand >>> i];
bits -= 6;
if (!(bits > 0)) {
@knalli
knalli / explicit.coffee
Created January 19, 2013 18:10
NodeUnit equalArrayitems
equalArrayItems = (actual, expected) ->
test.ok actual instanceof Array
test.ok expected instanceof Array
test.equals actual.length, expected.length
# Loop 1: All values of "expected" MUST be in "actual".
for item in expected
test.ok actual.indexOf(item) > -1
# Loop 2: All values of "actual" MUST be in "expected".
for item in actual
test.ok expected.indexOf(item) > -1
@knalli
knalli / example.html
Created March 31, 2013 19:13
Example of a tabp panel component.
<tabpanel>
<tap title="Panel 1">
<h2>Header</h2>
<p>Text<p<
</tap>
<tap title="Panel 2">
<img src="..."/>
</tap>
@knalli
knalli / example-dialog.html
Created March 31, 2013 19:20
A simple dialog component.
<dialog title="Are you sure deleting the internet?" type="yesno"></dialog>
@knalli
knalli / example_dialog.js
Last active December 15, 2015 15:28
Example of a dialog directive
angular.module('app').directive('dialog', function(){return{
template : '<div class="dialog dialog-{{type}}">'+
'<header><h1>{{title}}</h1></header>'+
'<button>No</button><button>Yes</button>'+
'</div>',
restrict: 'E',
replace: true,
scope: {
'title' : '@',
'type' : '@'
<div class="dialog dialog-yesno">
<header>
<h1>Are you sure deleting the internet?</h1>
</header>
<button>No</button>
<button>Yes</button>
</div>