1. A new blog

    Sun 24 November 2013 By jarv

    Hello world! It's been awhile and what better way to re-visit a blog then to do a re-design.

    I've cleaned house and removed some old articles, kept some of the AVR hacks and hopefully will post updates more than once a year :)


  2. Simple highscore tracking with Python / Flask

    Mon 17 December 2012 By jarv

    Below is a quick tutorial on how flask web framework might be used for simple highscore tracking. All of the source code the state game is now on github.

    This code will accept an AJAX GET or POST at the end of each game so that scores can be tracked and read. Since the use-cases are simple it's easy to write the tests first:

    class StateTestCase(unittest.TestCase):
    
        def setUp(self):
            self.db_fd, state.app.config['DATABASE'] = 
                tempfile.mkstemp()
            state.app.config['TESTING'] = True
            self.app = state.app.test_client()
            state.init_db()
    
        def tearDown(self):
            os.close(self.db_fd)
            os.unlink(state.app.config['DATABASE'])
    

    This above code will create an sqlite db before each test-case and remove it when completed.

    def test_empty_db(self):
        rv = self.app.get('/d')
        assert json.loads(rv.data) == []
    
    def test_single_entry(self):
        test_data = {
            'name': 'john doe',
            'score': 1234,
            'time': 1234
        }
        rv = self.app.post('/d', data=test_data)
        assert 'ok' in json.loads(rv.data)
        rv = self.app.get('/d')
        assert json.loads(rv.data) == [test_data]
    
    def test_multiple_entries(self):
        for score in range(0, 25):
            data = {'name': 'john doe',
                    'score': score,
                    'time': 1234}
            rv = self.app.post('/d', data=data)
            assert 'ok' in json.loads(rv.data …

    read more
  3. The State Game

    Sun 22 July 2012 By jarv

    Below is a recent weekend programming project that I did to play with canvas. Who doesn't like a geography game?

    It uses a simple svg image for the map with a canvas overlay to detect state clicks. On the back-end it uses a very short python script with web.py. Most people who tried it out found the rotation to be annoying and difficult; for me it makes it more interesting :)

    thestategame


  4. Musical Ms. Pacman Candy Tin Hack

    Sun 04 December 2011 By jarv

    Here is a weekend hack that uses the midi to AVR conversion script and library. With xmas fast approaching I thought it would be fun to convert a pacman candy tin to an xmas ornament and have it play music. Below is the result, pressing a button on the tin will cycle through three Ms. Pacman songs converted from midi files found online.


« Page 3 / 4 »