In this post we're going to continue our "Things which aren't magic tour" of JavaScript, by taking a quick look at JSONP, a neat trick which lets us share information across web services where we'd otherwise be unable to due to the Same-Origin Policy (in a world before CORS). To look into JSONP we're going to implement a simple API that will let us fetch data from a remote resource (we're going to…
So in the last edition of "Things which aren't magic" we took a look into Flask's @app.route() decorator, to see how decorators, side effects and a dash of regular expressions give us the magic @app.route() that exposes our Python functions to the World Wide Web. In this edition we're going to stick with the web-based theme, but switch languages and take a dive in to JavaScript, and more…
In my last post I finished off with a skeleton which mimicked the behaviour of "@app.route('/')" in the first example on the Flask website. If you missed that edition of "Things which aren't magic", then check it out here . In this post we're going to turn up the difficulty level a tiny bit and add the ability to have variable parameters in our URLs, by the end of this blog post we'll be able to…
It's been a while since I've posted so figured it's about time I started a new series on my blog. Here's the first edition of a series I'm calling "Things which aren't magic", where I show how some of the nicer APIs provided by popular open source packages are constructed from the primitives of their respective languages. In this post we're going to take a look at Flask , and more specifically how…
It's been a while since I've done a quick and dirty hack that's worth sharing. But inspiration sometimes comes from strange places . This particular hack is a way more fun to play with than to talk about, so I'll keep it brief. If you want to just check out the hack straight away (it's fairly self explanatory) just click here Contribution Graph Hacking People have been playing with their GitHub…
Whenever I'm writing a Web Application in PHP I love to get stuck in with the Yii Framework . Yii is often overlooked but is a fast, mature and stable PHP Framework which makes rapidly building or prototyping a Web app a joy. The URL Manager Yii sports great URL Management features, the URL Manager in Yii handles everything from the simple hiding of index.php to incredibly complicated rules which…
When developing bots for classical games such as Chess and Checkers the depth to which the engine evaluates the game tree is limited by the amount of time and by computing power. However when we play Tetris, the game itself imposes a hard limit on how far we are able see into the future, the preview provided is typically only in the range of 1 to 5 pieces. I was curious to see what could be done…