This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
typedef struct buffer_t { | |
void *data; | |
int length; | |
struct buffer_t* next; | |
struct buffer_t* prev; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: utf-8 -*- | |
from BeautifulSoup import BeautifulSoup | |
from random import sample, choice | |
import httplib2 | |
import sys | |
import pickle | |
import os.path | |
class Quotes(object): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() | |
{ | |
size(1000, 500); | |
verts = new ArrayList<Vertex>(); | |
for(int i=0;i<50;i++) { | |
verts.add(new Vertex(random(75, 150))); | |
} | |
background(bg); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 | |
numbers = (u'nolla',u'yksi',u'kaksi',u'kolme',u'neljä',u'viisi',u'kuusi',u'seitsemän',u'kahdeksan',u'yhdeksän',u'kymmenen') | |
suffixes = ((u'toista',u'kymmentä'), (u'sata',u'sataa')) | |
exponents = ((u'',u''), (u'tuhat',u'tuhatta'), (u'miljoona','miljoonaa')) | |
def ones(n, s): | |
if s == 0 or n == 1: | |
return u'' | |
return numbers[s] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ddf.minim.*; | |
import ddf.minim.signals.*; | |
import ddf.minim.analysis.*; | |
import ddf.minim.effects.*; | |
Minim minim; | |
AudioPlayer player; | |
AudioInput input; | |
FFT fft; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The most trivial implementation of what I need. Introduces code | |
duplication and can become a hassle to maintain if more and more | |
data sources are introduced. | |
What would be the best approach to keep the code organization as | |
simple as possible but on the other hand keep the clarity of this | |
two data source example? | |
When should a programmer "feel the pain" of code duplication? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use 'quil.core) | |
(def draw-state (atom :draw)) | |
(defn setup [] | |
(background 11 11 11) | |
(smooth)) | |
(defn my-random [min max] | |
(let [delta (- max min)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro play-chord | |
[ts notes] | |
(let [note-on (map #(list 'sampled-piano %) (eval notes))] | |
`(at ~ts ~@note-on))) | |
(play-chord (+ 1000 (now)) (chord :A4 :major7)) | |
; expands to | |
(overtone.live/at | |
(+ 1000 (now)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn multiple-of [number divisor] (and (not (= number divisor)) | |
(= (mod number divisor) 0))) | |
(defn not-multiples-or-1 [numbers divisor] | |
(filter (fn [n] | |
(and | |
(not (= n 1)) | |
(not (multiple-of n divisor)))) numbers)) | |
(defn primes-in-decreasing-seq [n] (reduce not-multiples-or-1 n (range 2 (Math/sqrt (first n))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import wraps | |
def db(selector): | |
def _funcall(function): | |
@wraps(function) | |
def _wrapper(row): | |
got_args = { | |
'primary': { '1': ('baba', 15), '2': ('gaga', 16) }, | |
'secondary': { '1': ('foo', 17), '2': ('bar', 18) }, | |
} |