This file contains hidden or 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 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"); | |
| } |
This file contains hidden or 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
| #!/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 |
This file contains hidden or 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
| 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 |