Skip to content

Instantly share code, notes, and snippets.

@JogoShugh
JogoShugh / gist:4689842
Created February 1, 2013 07:02
Query the VersionOne API or Stories
var url = "http://eval.versionone.net/platformtest/rest-1.v1/Data/Story/1154";
var headers = { Authorization: "Basic " + btoa("admin:admin"), Accept: "haljson" };
var settings = { url: url, headers: headers, dataType: "json" };
$.ajax(settings).done(function(data) {
beautifulJson = JSON.stringify(data, null, 4);
$("body").html("<pre>" + beautifulJson + "</pre>");
}).fail(function(jqXHR) {
$("body").html(jqXHR.responseText);
});
@JogoShugh
JogoShugh / fiddle.css
Created February 18, 2013 19:52 — forked from zalun/fiddle.css
body {
font-family: Helvetica, Verdana
}
p {
padding: 7px 10px;
}
#demo {
border: 1px solid #999;
}
@JogoShugh
JogoShugh / fiddle.css
Last active December 13, 2015 21:48
VersionOne MetaMorformizr
body {
padding: 5px;
font-family: sans-serif;
}
#editor {
padding: 10px;
border: 1px solid darkblue;
background: whitesmoke;
display: none;
margin-bottom: 15px;
@JogoShugh
JogoShugh / README.md
Last active December 13, 2015 21:58
MongoDB / Mongoose Spike

Setup

If you don't have CoffeeScript, then:

  • Type npm install -g coffee-script

Compiling and Running

@JogoShugh
JogoShugh / v1json.js
Created February 19, 2013 17:42
v1json.js -- convert VersionOne JSON response into cleaner, Backbone-friendly HAL format; Convert JSON to Asset XML for POST operations
define(function(){
function jsonClean(original) {
function processAsset(asset) {
var obj = {
"_links": {
"self": {
"href": asset.href,
"id": asset.id
}
@JogoShugh
JogoShugh / v1json.js
Created March 27, 2013 22:55
v1json for converting VersionOne JSON to cleaner, DTO-style JSON, and for converting a JS object to VersionOne Asset XML
function jsonClean(original) {
function processAsset(asset) {
var obj = {
"_links": {
"self": {
"href": asset.href,
"id": asset.id
}
}
};
@JogoShugh
JogoShugh / add.js
Created March 30, 2013 05:43
Simple calculator
Calculator.prototype.add = function () {
var result = 0;
for (var i = 0, j = arguments.length; i < j; i++) {
result += parseFloat(arguments[i]);
}
return result;
};
@JogoShugh
JogoShugh / EntryDetailsInfoView.html
Last active December 15, 2015 17:59
Extend Backone.Model to consume Azure resource
<h2>Details</h2>
<p><a href='{{support.href}}'>{{support.title}}</a></p>
<p><b>Cost:</b> {{cost}}</p>
<p>{{description}}</p>
<ul class='textLinks nav nav-tabs nav-stacked'>
{{#each textLinks}}
<li>
<a href="{{href}}">
<img src="img/{{type}}.png">
{{title}}
@JogoShugh
JogoShugh / controllers.coffee
Last active December 16, 2015 05:38
AngularJS Menu app examples
# Utilities
copy = (from, to, propertiesToCopy) ->
for property in propertiesToCopy
to[property] = from[property]
# Module setup
@Menu = angular.module 'Menu', []
# Routing
@Menu.config ($routeProvider) ->
@JogoShugh
JogoShugh / angular.min.js
Last active December 16, 2015 12:08
Angular Boostrap
/*
AngularJS v1.0.6
(c) 2010-2012 Google, Inc. http://angularjs.org
License: MIT
*/
(function(N,Y,q){'use strict';function n(b,a,c){var d;if(b)if(H(b))for(d in b)d!="prototype"&&d!="length"&&d!="name"&&b.hasOwnProperty(d)&&a.call(c,b[d],d);else if(b.forEach&&b.forEach!==n)b.forEach(a,c);else if(!b||typeof b.length!=="number"?0:typeof b.hasOwnProperty!="function"&&typeof b.constructor!="function"||b instanceof K||ca&&b instanceof ca||xa.call(b)!=="[object Object]"||typeof b.callee==="function")for(d=0;d<b.length;d++)a.call(c,b[d],d);else for(d in b)b.hasOwnProperty(d)&&a.call(c,b[d],
d);return b}function nb(b){var a=[],c;for(c in b)b.hasOwnProperty(c)&&a.push(c);return a.sort()}function fc(b,a,c){for(var d=nb(b),e=0;e<d.length;e++)a.call(c,b[d[e]],d[e]);return d}function ob(b){return function(a,c){b(c,a)}}function ya(){for(var b=aa.length,a;b;){b--;a=aa[b].charCodeAt(0);if(a==57)return aa[b]="A",aa.join("");if(a==90)aa[b]="0";else return aa[b]=String.fromCharCode(a+1),aa.join("")}aa.unshift("0");return aa.j