Skip to content

Instantly share code, notes, and snippets.

View CharlotteGore's full-sized avatar

Charlotte Gore CharlotteGore

View GitHub Profile
var panda = function () {
var bambooLevel = 0,
isAsleep = false,
wakeUp,
eatBamboo,
goToSleep;
wakeUp = function() {
isAsleep = false;
}
{
_links : {
self : {
href: "/tasks/2"
},
curie : {
name : "controls",
href : "/tasks/2#controls/{rel}",
templated : true
},
var test = dom('<a href="#products/{{_links.self.products}}" alt="something" rel="{{rels.products}}" />Check out all the {{products}}</a>');
var props = [];
Array.prototype.forEach.call(test.els[0].attributes, function(attr){
var tokens = attr.nodeValue.split(/\{\{|\}\}/);
if(tokens.length > 1){
var i = 0;
tokens.forEach(function(t){
i++;
// in app initialisation
var views = new HyperboneView()
.registerHelper('parser', require('marked'))
.registerHelper('date', require('date-formating-module'));
// test data..
var html = dom('<div>{{ parser( ProductDescription )}}</div>');
var model = new HyperboneModel({ ProductDescription : "__hello world__" });
// done automatically in a route handler...
@CharlotteGore
CharlotteGore / gist:7231389
Last active December 26, 2015 23:29
Hypermedia To-Do List Application API draft
/* GET:/ */
{
"_links" : {
"self" : {
"href" : "/"
},
"curie" : {
"name" : "controls"
"href" : "/rels/{rel}",
"templated" : true
@CharlotteGore
CharlotteGore / gist:7302318
Created November 4, 2013 13:20
Controls proposal
editresource : {
method : "PUT",
action : "/someaction",
encoding: "x-form-www-encoding"
properties : {
"username" : "Current Username",
"email" : "current@user.com",
"etag" : "123j123j1llkj31ljflkjsdlkj32lkjlkjf",
"things" : [1, 2]
},

Keybase proof

I hereby claim:

  • I am charlottegore on github.
  • I am charlottegore (https://keybase.io/charlottegore) on keybase.
  • I have a public key whose fingerprint is 2B6F 37DB 3A03 12D6 0228 5BB3 DEB1 06AF 9767 EF5E

To claim this, I am signing this object:

// version one... Create a clamp method.
Math.prototype.clamp = function clamp (num, min, max){
return Math.min(min, Math.max(num, max));
}
function getDayOfWeek (day){
return Math.clamp(day / 7, 0, 51)
}
// version two, module style
@CharlotteGore
CharlotteGore / gist:a6ee30b00eadd363da56
Created July 18, 2014 13:16
Very basic Javascript
function Tiger (){
this.name = "";
this.isKing = false;
}
Tiger.prototype = {
getName : function (){
if (this.isKing){
return this.name + ", who is the mother fucking King!";
} else {
@CharlotteGore
CharlotteGore / gist:fa9e6979eb55ab42f300
Created July 18, 2014 13:26
More basic Javascript
function Tiger (){
this.name = "";
this.isKing = false;
// you can define the methods this way...
this.setName = function (name){
this.name = name;
};