Skip to content

Instantly share code, notes, and snippets.

@autotelicum
Created September 21, 2011 18:44
Show Gist options
  • Save autotelicum/1232944 to your computer and use it in GitHub Desktop.
Save autotelicum/1232944 to your computer and use it in GitHub Desktop.
Simple check for non-ASCII identifiers
_ = 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]/)
faces = '⚀ ⚁ ⚂ ⚃ ⚄ ⚅'.split ' '
roll = Math.floor Math.random() * 6 + 1
console.log faces[roll]
[δ, π, ι] = [3.1428571429, 22/7, 1e-6]
console.log "π ≇ #{δ}" if π - ι < δ < π + ι
@autotelicum
Copy link
Author

Lets start small™ CoffeeLint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment