Skip to content

Instantly share code, notes, and snippets.

@g-k
g-k / grunt-notes.md
Created September 17, 2012 04:15
Notes from playing with grunt.js

Last week I thought I'd move a few hundred lines of our build process from our custom build tool to grunt.

I ran into a problem with grunt.task.run queuing a task but not waiting for the task to complete before continuing or ensuring execution order (relevant testcase).

Maybe it was problem with the child processes not executing

@g-k
g-k / exposed-module-to-mock.md
Created September 21, 2012 03:45
Note on exposing a required module to test it.

I ran into some trouble writing jasmine unit tests for request.pipe today.

Exposing the request module instead of modifying require or stubbing request was easiest:

# actions.coffee
request = require 'request'

module.exports = 
@g-k
g-k / clean-prime-chains.py
Created September 27, 2012 03:19
Clean Prime Chains
import math
def eratosthenes(n):
"""
Sieve of Eratosthenes
>>> eratosthenes(19)
[1, 2, 3, 5, 7, 11, 13, 17, 19]
@g-k
g-k / README.md
Created October 2, 2012 04:03
Boustrophedons with CSS transforms
@g-k
g-k / sorting-knots.md
Created October 3, 2012 02:01
What knots correspond to unsorted data?

Figure 6 of this paper looks like a weave sorting visualization.

Do different types of unsorted data correspond to certain kinds of knots or do we just visualize them in similar ways?

If the max and min of an unsorted array correspond to ends of a string and an unknotted string corresponds to a sorted array, then untying data seems similar to sorting a string.

Might be covered rigorously in one of these classes:

@g-k
g-k / smalltalk-notes.md
Created October 3, 2012 03:06
some smalltalk notes

Playing with smalltalk over the weekend.

Got through the koans and some of the tutorial. Some notes:

  • Smalltalk has Ruby-style blocks or, more likely, Ruby inherited blocks from smalltalk.

  • Not much about methods for Object-Oriented language, presumably because everything is a method.

  • Smalltalk message chaining looks like Javascript method chaining or

@g-k
g-k / python-3.3-release-notes-notes.md
Created October 3, 2012 23:16
Python 3.3 Release Notes

Python 3.3 was released recently.

  • Better property-based testing with function signatures

  • Inspect for closures and generators should make testing things that aren't classes easier

  • ChainMap should clean up template languages and could provide JS prototype styles lookups

  • Learned about the webbrowser module (it's not new, but Chrome support is):

@g-k
g-k / leaderboard.css
Created October 23, 2012 01:23
meteor.js leaderboard example exercises
body {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: 200;
margin: 50px 0;
padding: 0;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-o-user-select: none;
user-select: none;
@g-k
g-k / index.html
Created October 29, 2012 00:01
Graphs for Kaprekar's Routine
<!DOCTYPE html>
<html>
<head>
<title>Kaprekar's Routine</title>
<link type="text/css" rel="stylesheet" href="style.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/d3/2.10.0/d3.v2.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.1/underscore-min.js"></script>
<script src="kaprekate.js"></script>