Skip to main content

Posts

Showing posts with the label gist

Board Game Geek Data - Sliced and Diced

Inspired by the discovery of the API for the BoardGameGeek website , I decided to play around with some of its data by some Ruby and JavaScript scripting. One thing I wanted to look at was the interconnectedness of game mechanics, but first I wanted to find alternative ways to look at how to measure ones "use" of ones game collection, and the associated question of "can a board game collection ever be too big?". H-index and play per game For example, the concept of H-index  is being discussed quite a bit on the ’geek. In short this entails sorting your games by number of plays and finding the last entry in the list with a number of plays higher than (or equal to) the position in the list. It’s rank is your H-index. (This does, of course require one to  meticulously  log ones plays, but that is another story… For example my overall BGG H-index for the last 12 months is (or seems to be) a measly 5.) Another concept used is to take the number og games owned an...

Instaworries -- and a resulting mass unfollowing hack

The other day I noticed/remembered that I had an instagram account. And, according to my sister, I was quite active on it. Apparently. I kept following new persons. That suprised me, so I logged on and investigated. “I” followed 974 (or so) persons I had never heard of… My first instinct was to delete the account.* But that would have been too easy, so I decided to investigate the Instagram-API to see if that could help me “get rid” (most) of the people I followed. And lo and behold I found this page  - very promising, so I registered an app to get access to this. Since Instagram uses OAuth that landed me a client ID and a client secret. Not awfully familiar with the innards of OAuth, I realized that for anything to work I would need an access token. Since this script was just for personal use, I figured I could just generate this once(ish) and use that to get access to my account. I followed the instructions on this (page):  http://dmolsen.com/2013/04/05/generating-access-...

Add overall lesson timing to video listings on Coursera

Marché de La Rochelle HDR  Probably about two years ago - when taking Andrew Ng's excellent "Machine Learning" MOOC, Johannes sent me a piece of JavaScript that populated the video lists with overall time per lesson just by pasting it into the URL-thingy in Chrome. Magic. Today when I sat down to start the course on "General Game Playing" that I have signed up for, but, alas, not (yet) found much time for, I thought of that piece of code and wondered if I, with my new knowledge of JavaScript, could whip up something like that. (Also I couldn't find Johannes' original one.) I quickly hacked together something this afternoon over a flat white in a hipster cafe here in Lyon. And lo and behold it worked. Then I extended the functionality to also show minutes and seconds of unwatched video - as well as total overall counters for the entire course. Now each lesson heading reads "Lesson N - Name [time remaining/total time]" instead of just ...

D3 Map Projections Morphing

Map of Australia mapped on Australia We had a very good geography teacher in high school. He taught us how one should be sceptical and keep an open mind in science (using an anecdote about a scientist proposing an alternative to the theory of tectonic drift). He was also the first person I met that had surfed the Internet - or whatever it was called back in the day. But the thing he showed me the importance of, most relevant to this blog post, is the choice of projections of world maps. You know, the whole 3D globe to 2D piece of paper business. Mapping, qoui. Some are just more equal than others. You see, yesterday evening I decided to finally take a closer look at the D3 visualization library. A couple of the demos on the d3js page , notably the excellent animated  show reel and some of the mapping examples , made me think of discussions I have had with colleagues and friends on map projections. I wondered if animating the transition from one projection to anoth...

D3, gists, and bl.ocks.org

Yesterday I stumbled upon a very useful tool while (trying to) teach(ing) myself D3, namely http://bl.ocks.org . This lets you access, and preview, your webby gists in a browser - just by browsing to http://bl.ocks.org/<gist-id>. Most handy! (The only minor down side is that there seems to be a slight latency if you update your gist before it updates on bl.ocks.org.)

Tabular data from PDFs with the help of Ruby

Sometimes I need to get data out of tables buried in PDFs, so I've written a tiny adaptable Ruby hack for when copying and pasting doesn't cut it - exploiting a couple of excellent libraries. Here's an example. Loading... (Admittedly not the most elegant of scripts, but hey! it gets the job done.) What I do first here is just load up the relevant libraries. (The pdf-reader I use is this one: https://github.com/yob/pdf-reader - installable with a simple command line 'sudo gem install pdf-reader' if you are using Ruby 1.9. (Drop the sudo if you're on Windows.)) Next up is to instantiate input pdf and output table. Straight forward enough. By examining the pdf I found the data I was interested in on pages 42 through 69, so a simple call to pages give me those -  pdf_reader . pages [ 42 . . 69 ] . I'll go through the text on each of them line by line and decide if they contain what I want based on regular expressions. These are my simple rules (in th...

Gists on Blogger

Today I wondered how to add nice-looking gists to future posts here on my dynamic themed blog, and found the following solution: http://blog.moski.me/2012/01/gist-with-bloggers-dynamic-views.html  (Thanks Moski.) That's all. Update 10/12/2014: The script has now moved (Ref: https://stackoverflow.com/questions/24005430/moski-gist-blogger-not-loading-gists-in-chrome-for-gists-in-blogger-dynamic-vie ) Update 25/04/2020: This guide is better: https://betterstack.dev/blog/how-to-embed-a-github-gist-in-your-website/ .