Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
set -e
errors=$(/usr/local/php7/sbin/php-fpm --fpm-config /usr/local/php7/etc/php-fpm.conf -t 2>&1 | grep "\[ERROR\]" || true);
if [ -n "$errors" ]; then
echo "Please fix your configuration file…"
echo $errors
exit 1
fi
exit 0
Try to create a "Person" model,that we can use the “children” method below.
>> tom = Person.create(name: “Tom”)
>> may = Person.create(name: “May”, parent: tom)
>> syd = Person.create(name: “Syd”, parent: tom)
>> tom.children.map(&:name)
=> [“Syd”, “May”]
Furthermore,can you design "grandchildren" method that we can use it like this?
>> wen = Person.create(name: “Wen”, parent: syd)
>> jon = Person.create(name: “Jon”, parent: may)
>> tom.grandchildren.map(&:name)
@minjindang
minjindang / colemanLiau.js
Created September 3, 2015 08:33
Coleman-Liau function
function colemanLiau(counts) {
var LETTER_WEIGHT = 0.0588;
var SENTENCE_WEIGHT = 0.296;
var BASE = 15.8;
var PERCENTAGE = 100;
if (!counts || !counts.sentence || !counts.word || !counts.letter) {
return NaN;
}