Skip to content

Instantly share code, notes, and snippets.

'use strict'
class CharUtils {
static between(ch, low, hi) {
return (ch.charCodeAt(0) >= low.charCodeAt(0) && ch.charCodeAt(0) <= hi.charCodeAt(0));
}
static isDigit(ch) {
return CharUtils.between(ch, "0", "9");
}
@xenocid
xenocid / objc2all.sh
Created June 20, 2012 22:04
Converting Obj-c to CPP code
#!/usr/bin/env sh
# WARNING:
# WARNING: This script may destroy your code, make sure to backup before running.
# WARNING:
################################
# convert .m files to .cpp
################################
#ls -1 *.m | while read f
@xenocid
xenocid / Pixelize.rb
Created June 28, 2011 18:19
My entry to the 2nd round of the CodeBrawl
require 'chunky_png'
include ChunkyPNG::Color
include ChunkyPNG::Canvas::Drawing
input = ChunkyPNG::Image.from_file('input.png')
# Put your logic to averageize `image` here.
BLOCK_SIZE = 10
height = input.height