Skip to content

Instantly share code, notes, and snippets.

View biilmann's full-sized avatar
💭
Waiting for pod to exist...

Mathias Biilmann biilmann

💭
Waiting for pod to exist...
View GitHub Profile
var countdown = function count(num) {
console.log(num);
if (num <= 0) { count(num - 1); }
}
countdown(2);
count(2);
if (console.log) {
function greet(name) { console.log(name); }
} else {
function greet(name) { alert(name); }
}
function example3() {
function f() { console.log("First f"); }
return f();
function f() { console.log("Second f"); }
}
example3();
function example1() {
f();
function f() { console.log("f"); }
}
example1();
// Function declaration
function hello() { console.log("Hello"); }
// Function expression
var hello = function() { console.log("Hello"); }
// Function expressions with binding identifier
var hello = function hello() { console.log("Hello"); }
function example2() {
f();
var f = function() { console.log("f"); }
}
example2();
<pop:sections>
<li class="<pop:first>first</pop:first> <pop:last>last</pop:last>"><a href="<pop:permalink/>"><pop:title/></a></li>
</pop:sections>
@biilmann
biilmann / redirects.js
Created March 18, 2013 22:30
Manual redirects
exports.get = {
"Product1": function(params) {
response.send("Redirecting", {Location: "/products/product1"}, 301);
},
"Product2": function(params) {
response.send("Redirecting", {Location: "/products/product2"}, 301);
}
}
@biilmann
biilmann / example.tpl
Created March 18, 2013 21:07
Random shuffle for image galleries
<!-- Content with image gallery field called "image_gallery" -->
<pop:content>
<pop:random:gallery field="image_gallery">
<pop:value resize="fill" width="200"/>
<pop:random:gallery>
</pop:content>
@biilmann
biilmann / template.tpl
Created December 3, 2012 19:58
Using an extension to split a textarea into lines
<pop:content>
<select name="sizes">
<pop:utils:split field="sizes">
<option><pop:value/></option>
</pop:utils:split>
</select>
</pop:content>