This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Template Name: Page with downloads | |
*/ | |
?> | |
<?php the_post(); ?> | |
<?php get_header(); ?> | |
<?php get_sidebar(); ?> | |
<div id="mainContent"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = wrench.appify({ | |
init: function () { | |
// this will run after in the boot up process initiated by app.run(); | |
}, | |
users: { | |
list: route("users/list/").to(function () { | |
// fetch all the users and show them on the page | |
}), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this assert | |
assert ActionMailer::Base.deliveries.present? | |
# gives this error when running tests | |
NoMethodError: undefined method `deliveries' for #<TMail::Mail:0x1094e3a90> | |
/test/unit/user_test.rb:69:in `test_should_create_token_and_email' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
W.GET("/", function () { | |
$('#app').html("Hello World"); | |
}); | |
W.GET("#users", function () { | |
$('#app').html("users"); | |
}); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://en.wikipedia.org/wiki/Bank_card_number | |
CARDTYPES = { | |
:visa => /^4(?!571|917|913|508|844|17500)[0-9]{12,15}$/, | |
:mastercard => /^5(?!4130380)[1-5][0-9]{14}$/, | |
:dinersclub => /^3(?:0[0-5]|[68][0-9])[0-9]{11}$/, | |
:amex => /^3[47][0-9]{13}$/, | |
:discover => /^6(?:011|5[0-9]{2})[0-9]{12}$/, | |
:visadankort => /^4571[0-9]{12}$/, | |
:dankort => /^5019[0-9]{12}$/, | |
:eurocardbyinvitation => /^54130380\d{8}/, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Classical | |
class Animal | |
color: 'brown' | |
sleep: (minutes) -> | |
"sleeping for " + minutes + " minutes" | |
class Horse extends Animal | |
legs: 4 | |
gallop: -> | |
"galloping happily" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
var PublicAPI = window.PublicAPI = {}; | |
PublicAPI.publicFunction = function (foo) { | |
PrivateAPI.privateFunction(foo); | |
return 'bar'; | |
}; | |
var PrivateAPI = {}; | |
PrivateAPI.privateFunction = function (foo) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
var PublicAPI = window.PublicAPI = {}; | |
PublicAPI.publicFunction = function (foo) { | |
PrivateAPI.privateFunction(foo); | |
return 'bar'; | |
}; | |
var PrivateAPI = {}; | |
PrivateAPI.privateFunction = function (foo) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simplified example | |
App.Controllers.Sales = Object.create(App.Controllers.Master, { | |
all: function () { | |
// Find all method on Sale initiates a callback when data has returnes | |
App.Models.Sale.findAll(function () { | |
// render method on $ initiate a callback when the template has been loaded in the dom | |
$('contentarea').render("sales/all", function (sales) { | |
// Pure template autoRender method finds some id and auto loops over and array | |
$('#id-of-a-list-of-sales').autoRender(sales); |