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
def combine_nums(line) | |
line.gsub!(/(\d+), (?=(\d+))/) { # combine consecutive & identical numbers | |
if $2.to_i - $1.to_i == 1 # (looks-ahead so as to check | |
"#{$1}-" # every set of two numbers) | |
elsif $2.to_i == $1.to_i | |
"" | |
else | |
"#{$1}, " | |
end | |
} |
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' | |
stars = (n) -> | |
num_stars = Math.round ((n - 1) * -5) # 0 = perfect score; 1 = total mismatch | |
if num_stars | |
Array(num_stars + 1).join '★' | |
else | |
'' | |
truncate_to_word = (string, maxLength) -> |
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
http = require 'http' | |
_ = require 'underscore' | |
clm = require './clm.json' | |
requestHandler = (request, response) -> | |
id = request.url.match /\/(\d+)/ | |
message = 'No record found' | |
if id and id[1] |
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
cheerio = require 'cheerio' | |
fs = require 'fs' | |
acts_and_links = require './acts-and-links' | |
template = fs.readFileSync 'templates/template.html' | |
intro = fs.readFileSync 'templates/intro.html' | |
path = '../www/problems-at-school/' | |
error_handler = (err) -> console.log err if err |
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
IncomingMessage { | |
_readableState: | |
ReadableState { | |
objectMode: false, | |
highWaterMark: 16384, |
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
// Modified from https://community.adobe.com/t5/indesign/release-all-anchored-objects-at-once/td-p/3807944?page=1 | |
var items = app.activeDocument.allPageItems, count = 0 | |
if(confirm("Okay to attempt to free the contents of ~roughly~ " + items.length + " anchored text boxes, styling them as 'Reference'?")) { | |
while(item = items.pop()) { | |
if(item.isValid && | |
item.hasOwnProperty('anchoredObjectSettings') && | |
item.parent instanceof Character && |
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
// Modified from https://community.adobe.com/t5/indesign/release-all-anchored-objects-at-once/td-p/3807944?page=1 | |
var items = app.activeDocument.allPageItems, count = 0 | |
if(confirm("Okay to attempt to free the contents of ~roughly~ " + items.length + " anchored text boxes, styling them as 'Reference'?")) { | |
if(app.activeDocument.paragraphStyles.item('Reference') == null) { | |
app.activeDocument.paragraphStyles.add({ name: 'Reference' }); | |
} |