⚠️ Note 2023-01-21
Some things have changed since I originally wrote this in 2016. I have updated a few minor details, and the advice is still broadly the same, but there are some new Cloudflare features you can (and should) take advantage of. In particular, pay attention to Trevor Stevens' comment here from 22 January 2022, and Matt Stenson's useful caching advice. In addition, Backblaze, with whom Cloudflare are a Bandwidth Alliance partner, have published their own guide detailing how to use Cloudflare's Web Workers to cache content from B2 private buckets. That is worth reading,
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
#!/usr/bin/php | |
<?php | |
error_reporting(E_ALL); | |
if (count($argv) <= 1) { | |
print("usage createMockup src_dir dst_dir images_dir\n"); | |
print("\tsrc_dir : dir where all bmml file are\n"); | |
print("\tdst_dir : dir where write all html files\n"); | |
print("\timages_dir : dir where all export mockup png are (will be copied to the \$dst_dir/images directory)\n"); | |
exit(1); | |
} |
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
Handlebars.registerHelper('loc', function(property, fn) { | |
var str; | |
// we are bound to a value, it is now the context | |
if (fn.contexts && typeof fn.contexts[0] === 'string') { | |
str = fn.contexts[0]; | |
// Convention, start all localization keys with _ | |
} else if (property[0] === '_') { | |
str = property; |
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 CONSUMER_KEY = "<< YOUR KEY HERE >>"; | |
var CONSUMER_SECRET = "<< YOUR SECRET HERE >>"; | |
function getConsumerKey() { | |
return CONSUMER_KEY; | |
} | |
function getConsumerSecret() { | |
return CONSUMER_SECRET; | |
} |
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
// Support: http://caniuse.com/promises | |
function Http () { | |
/** | |
* Helper for http calls | |
* @param method | |
* @param url | |
* @param data | |
* @returns {Promise} | |
*/ | |
function makeRequest(method,url,data) { |
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
// API return format is as so: | |
// { | |
// data: [ | |
// { | |
// name: 'foo' | |
// }, | |
// { | |
// name: 'bar' | |
// } | |
// ] |