Sort of a rambling introduction I picked up a FitBit Ionic recently, partially for the heart rate tracking, but I won’t pretend that a fair amount of the motivation behind it was because it’s the only smartwatch at the moment…
Sort of a rambling introduction I picked up a FitBit Ionic recently, partially for the heart rate tracking, but I won’t pretend that a fair amount of the motivation behind it was because it’s the only smartwatch at the moment…
Introduction Executive summary: need to export your Neo4j favourites to co-workers, friends and family? This article provides a JavaScript solution, as well as a Chrome extension, to do so. Neo4j is a really cool, fast and powerful graph database. It…
Spoilers: this article makes an incredibly basic clone of an NPM repo, with just the dependencies required for the job required of NPM, then makes it available for developers to run an npm installĀ on. The Problem It seems like every…
Introduction JavaFX’s integration with web pagesĀ is quite impressive – you can query the DOM, execute arbitrary JavaScript and get results back. In addition, you can trigger changes on the Java-side from the web page. In this brief introduction we’ll look…
Following on from a bout of attempting (and finally succeeding) to get the content and background scripts in a Chrome extension to talk to one another, this seemed like a perfect opportunity to write down a couple of the things…
Introduction “Da da da dum! Doesn’t that stir anything in you?” Ford Prefect, The Hitchhiker’s Guide to the Galaxy Sound and music have been an part of our society since time unknown. Impossible as it would be to describe to…
Impress.js impress.js is a beautiful piece of a presentation library that uses HTML5 elements to give you a continuous ‘infinite’ presentation surface. This allows you to develop presentations employing effects that are simply impossible using a traditional slide-based deck. The…
Introduction subskybox wrote an intimidating 5-card poker hand analyzer in four linesĀ of JavaScript. The original is somewhat tricky to understand initially:
1 2 3 4 5 6 7 8 9 10 11 |
hands=["4 of a Kind", "Straight Flush", "Straight", "Flush", "High Card", "1 Pair", "2 Pair", "Royal Flush", "3 of a Kind", "Full House" ]; var A=14, K=13, Q=12, J=11, _ = { "ā ":1, "ā£":2, "ā„":4, "ā¦":8 }; function rankPokerHand(cs,ss) { var v, i, o, s = 1<<cs[0]|1<<cs[1]|1<<cs[2]|1<<cs[3]|1<<cs[4]; for (i=-1, v=o=0; i<5; i++, o=Math.pow(2,cs[i]*4)) {v += o*((v/o&15)+1);} v = v % 15 - ((s/(s&-s) == 31) || (s == 0x403c) ? 3 : 1); v -= (ss[0] == (ss[1]|ss[2]|ss[3]|ss[4])) * ((s == 0x7c00) ? -5 : 1); document.write("Hand: " + hands[v] + (s == 0x403c?" (Ace low)":"")+"<br/>"); } |
Of course, by somewhat tricky I mean extremely tricky, and by initially I mean always. The shock and…
In an attempt to bring some sort of order to my JavaScript projects, I’m introducing the require.js library. As it says, require.js is a Javascript file and module loader.
1 |
<script src="scripts/requirement34aFinal.js"></script> |
This means that I can break away from HTML files…