Skip to content

Instantly share code, notes, and snippets.

Avatar

James Griffin jsgriffin

View GitHub Profile
@jsgriffin
jsgriffin / juuid.rb
Created Jan 4, 2019
Java, UUIDs, Mongo, & Ruby
View juuid.rb
require 'base64'
# Adapted from https://github.com/mongodb/mongo-csharp-driver/blob/master/uuidhelpers.js
def hexToBase64(hex)
base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
base64 = ""
for i in (0..29).step(6)
group = hex[i..i+5].to_i(base=16)
base64 += base64Digits[(group >> 18) & 0x3f]
@jsgriffin
jsgriffin / article-clustering-task.md
Created May 25, 2011
Article Clustering Dev Task
View article-clustering-task.md

Article Clustering

One of the things we do at idio is to group articles, so that users who are interested in a particular topic can easily and quickly find a range of articles on that topic. Attached to this task, you will find a small sample of content. It is your job to write an algorithm - in PHP, Python or Ruby - that will cluster these articles by topic.

Deliverables

  • The source code for your algorithm
  • The results of running it on the sample data
  • Document - in [Markdown][md] or [Textile][textile] - which describes the algorithm you created, why you chose it and how it could be improved, and also talks about any other techniques which you discarded.
View idio-puzzles.md

Task 1: Twitter Wars!

idio has two offices in the UK, the first in Exeter and the second in London. As avid and curious Twitter users we'd like to find out whether the population of Exeter or London are better at spelling. By using the [Twitter API][twit], aggregate and analyse tweets from Exeter and London.

Assumptions

  • Hashtags and @ replies contained in tweets can be ignored and should not have an impact on the overall spelling quality of a tweet.
  • Decisions about how you classify what a tweet from London is and what a tweet from Exeter is are for you to make.
  • Decisions about the scoring of individual tweets are for you to make.
View Bash RC Git Branch
function parse_git_branch()
{
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
branch=$(git branch | grep -e '*' | sed s/\*\ //g)
echo ${branch}" "
}
shopt -s autocd
function update_prompt()
You can’t perform that action at this time.