Created
September 21, 2011 18:44
-
-
Save autotelicum/1232944 to your computer and use it in GitHub Desktop.
Simple check for non-ASCII identifiers
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
_ = require 'underscore' | |
cs = require('coffee-script').CoffeeScript | |
fs = require 'fs' | |
read = (f) -> if fs.statSync(f).isFile() then fs.readFileSync f, 'utf8' | |
tokens = cs.tokens read _.last process.argv | |
ids = _.uniq (token[1] for token in tokens when token[0] is 'IDENTIFIER') | |
console.log 'Identifiers that contain non-ASCII characters:' | |
console.log (id for id in ids when id.match /[^\w]/) |
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
faces = '⚀ ⚁ ⚂ ⚃ ⚄ ⚅'.split ' ' | |
roll = Math.floor Math.random() * 6 + 1 | |
console.log faces[roll] | |
[δ, π, ι] = [3.1428571429, 22/7, 1e-6] | |
console.log "π ≇ #{δ}" if π - ι < δ < π + ι |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Lets start small™ CoffeeLint