Skip to content

Instantly share code, notes, and snippets.

View jakearchibald's full-sized avatar
💭
Tired

Jake Archibald jakearchibald

💭
Tired
View GitHub Profile
function assertOkResponse(response) {
if (response.type === 'opaque' || response.status === 200) {
return response;
}
throw Error("Bad response: " + response.status);
}
fetch(url, {'mode': 'cors'}).then(assertOkResponse).then(function(response) {
// cache
}).catch(function(err) {
@jakearchibald
jakearchibald / dabblet.css
Created March 26, 2012 09:38 — forked from anonymous/dabblet.css
Untitled
.test, .test2 {
width: 200px;
height: 200px;
background: green;
border-radius: 500px;
position: relative;
transition: all 2s linear;
left: 0;
margin: 0 0 10px;
}
function getItemIndex(elm) {
var siblings = elm.slice(0,1).parent().children(),
i = siblings.length;
while(i--) {
if (siblings[i] == elm[0]) {
return i;
}
}
return -1;
glow.ready(function() {
var myPanel = new glow.widgets.Panel("#formPanel");
//display panel
myPanel.show();
})
// create our form
var myForm = new glow.forms.Form("#fmcustomer")
var myForm = glow.lang.trim("txtCompany","txtForename","txtSurname2)
// add tests for First Name
.addTests(
"txtCompany",
["required", {
on: "change submit",
message: "Please tell us your company name"
}]