1
2
3
4
int
main(int argc, char **argv)
{
...

C On argv iteration

by Chris Jester-Young, April 30, 2009 21:40 Star_fullStar_fullStar_fullStar_full

Your method is mostly good,...

729442eea8d8548842a6e0947e333c7b Talk
1
2
3
4
import java.util.EnumMap;
import java.util.Map;

...

Java On Stats

by Chris Jester-Young, April 23, 2009 01:18 Star_fullStar_fullStar_fullStar_fullStar_full

Seriously, a better solutio...

729442eea8d8548842a6e0947e333c7b Talk
1
2
3
4
public int getStat(String stat) {
    try {
        Field field = Stats.class.getField(stat.toUpperCase());
...

Java On Stats

by Chris Jester-Young, April 23, 2009 01:14 Star_fullStar_fullStar_fullStar_fullStar_full

Use reflection! :-P

729442eea8d8548842a6e0947e333c7b Talk
1
2
3
(define (compose . fns)
  (define (make-chain fn chain)
...

Lisp On Generalised composition

by Chris Jester-Young, April 22, 2009 05:07

zbigniew from freenode #sch...

729442eea8d8548842a6e0947e333c7b Talk
1
2
3
(define (compose . fns)
  (define (make-chain fn chain)
...

Lisp Generalised composition

by Chris Jester-Young, April 22, 2009 04:24, 1 refactoring, tagged with scheme, functional, compose

Most people have worked wit...

729442eea8d8548842a6e0947e333c7b Talk
1
2
3
4
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
...

C Writing characters to stdou...

by Chris Jester-Young, October 28, 2008 11:32, 1 refactoring, tagged with rate limiting, timing
729442eea8d8548842a6e0947e333c7b Talk
1
2
3
%
%   A simple test program to calculate pi, using an easy, slow converging formula
...

C On Fastest way to get value of pi

by Chris Jester-Young, August 31, 2008 22:34

@evilteach: Thanks for that...

729442eea8d8548842a6e0947e333c7b Talk
1
2
3
#!/usr/bin/perl -w
package Bdecode;
...

Perl Bencode decoder

by Chris Jester-Young, August 22, 2008 01:19, No refactoring, tagged with bencode, bdecode, torrent

The BitTorrent .torrent fil...

729442eea8d8548842a6e0947e333c7b Talk
1
2
3
#include <math.h>
#include <stdio.h>
...

C Fastest way to get value of pi

by Chris Jester-Young, July 30, 2008 03:50, 3 refactorings, tagged with pi, speed, language agnostic

Solutions welcome in any la...

729442eea8d8548842a6e0947e333c7b Talk

C# On I hate to do this, but...

by Chris Jester-Young, July 18, 2008 01:45

@Wolfbyte: Haha, nice. Very...

729442eea8d8548842a6e0947e333c7b Talk
1
2
3
my %fbmap = (3 => 'Fizz', 5 => 'Buzz');
my $fizzbuzz = sub {
...

C# On I hate to do this, but...

by Chris Jester-Young, July 16, 2008 10:20 Star_full

Implementation in Perl. :-P...

729442eea8d8548842a6e0947e333c7b Talk
1
2
3
4
<?php
function addSecondsToTimestamp ($_timestamp, $_amount) {
    list($year, $month, $day, $hours, $minutes, $seconds) = preg_split('/[- :]/', $_timestamp);
...

PHP On Adding seconds to a MySQL t...

by Chris Jester-Young, July 14, 2008 21:50 Star_fullStar_fullStar_fullStar_full

My fixes below are really t...

729442eea8d8548842a6e0947e333c7b Talk

C# On Balance HTML Tags

by Chris Jester-Young, July 14, 2008 11:52

@Konrad: on your suggestion...

729442eea8d8548842a6e0947e333c7b Talk

C# On Balance HTML Tags

by Chris Jester-Young, July 14, 2008 10:45

Hats off to Corbin for an e...

729442eea8d8548842a6e0947e333c7b Talk
1
2
#!/bin/bash
printf '%s\t%s\n' "$(date)" "$*" >> ~/progress/progress.txt

Bash On store string from terminal ...

by Chris Jester-Young, July 08, 2008 11:36 Star_fullStar_fullStar_fullStar_fullStar_full

Here's a one-liner (excludi...

729442eea8d8548842a6e0947e333c7b Talk

Ruby On Tracking error in numbers

by Chris Jester-Young, June 30, 2008 00:08

I don't know whether your s...

729442eea8d8548842a6e0947e333c7b Talk
1
2
3
4
function _TDisplay() {
    var self = this;
    this.tick = function () {
...

JavaScript On countdown timer (minutes &a...

by Chris Jester-Young, June 29, 2008 22:23

@Ryan: Yes, it seems backwa...

729442eea8d8548842a6e0947e333c7b Talk
1
2
3
(define (group-by x n)
  (unfold
...

Lisp On Group-by

by Chris Jester-Young, June 29, 2008 09:33

The function can be made ev...

729442eea8d8548842a6e0947e333c7b Talk
1
2
3
(define (split-at-or-earlier! x i)
  (let 
...

Lisp On Group-by

by Chris Jester-Young, June 25, 2008 17:36

Here is a demonstration of ...

729442eea8d8548842a6e0947e333c7b Talk

C# On Sanitize HTML

by Chris Jester-Young, June 25, 2008 01:22

@Mike: That sounds like a g...

729442eea8d8548842a6e0947e333c7b Talk

C# On Sanitize HTML

by Chris Jester-Young, June 25, 2008 00:50

@Rob, @mmp1: (Re use of a D...

729442eea8d8548842a6e0947e333c7b Talk

C# On Sanitize HTML

by Chris Jester-Young, June 25, 2008 00:41

@Stefan: The result of clea...

729442eea8d8548842a6e0947e333c7b Talk
1
2
3
;; To activate SRFI 1:
;; MzScheme 372: (require (lib "1.ss" "srfi"))
...

Lisp On Group-by

by Chris Jester-Young, June 23, 2008 10:59

Here's a very cheap answer ...

729442eea8d8548842a6e0947e333c7b Talk

Java On Simple interpreter

by Chris Jester-Young, June 23, 2008 09:18

I don't have a code refacto...

729442eea8d8548842a6e0947e333c7b Talk

C# On Sanitize HTML

by Chris Jester-Young, June 22, 2008 23:30

@Jonathan: New elements com...

729442eea8d8548842a6e0947e333c7b Talk