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
export const BarThemes = { | |
fractional: [' ', '▏', '▎', '▍', '▌', '▋', '▊', '▉', '█'], | |
shaded: [' ', '░', '▒', '▓', '█'], | |
simple: ['▒', '█'], | |
ascii: ['-', '#'], | |
}; | |
// Renders a fixed-length ASCII progress bar that supports | |
// fractionally-filled characters using Unicode boxes and bars. |
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
Eleventy can process a bunch of markdown files into HTML for a blog, but it's also handy for turning big data files into individual HTML pages. https://www.11ty.dev/docs/data-global/ and https://www.11ty.dev/docs/pagination/ have the skinny. | |
project folder | |
├─ .eleventy.js <-- control/override plugins, templating, directory names, etc | |
│ | |
│ | |
├─ src <-- Your content, data files, templates, etc | |
│ ├─ _data <-- JSON files you put here become part of the 'global data' | |
│ │ └─ foo.json <-- any template can use this data as {{ data.foo }} | |
│ └─ foo-things.html <-- uses 'pagination' to output one page for each record in foo |
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
// full API options at https://github.com/Keyang/node-csvtojson | |
const csv = require('csvtojson'); | |
// Commonly-tweaked defaults | |
const options = { | |
delimiter: ",", | |
trim: true, | |
ignoreEmpty: false, | |
flatKeys: false, |
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
// Check whether a node's bundle has a particular field | |
if ($node->hasField('field_might_be_missing')) { ... } | |
// Check field-type-specific empty/not empty logic | |
if ($node->field_name->isEmpty()) { ... } | |
// Iterate over individual instances in a field. field_name isn't an actual | |
// array, but a special iteratable class, so it won't die if the field is empty. | |
foreach ($node->field_name as $delta => $field_instance) { ... } |
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
use Drupal\Core\Routing\RouteMatchInterface; | |
use Drupal\Core\Entity\EntityInterface; | |
use Drupal\Component\Utility\Html; | |
use \Drupal\node\Entity\Node; | |
function relater_node_presave(EntityInterface $node) { | |
if ($node->bundle() == 'my_custom_node') { | |
$embeds = _relater_get_embeds($node); | |
$node->field_my_entityref->setValue($embeds); |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Setting up Craft CMS: | |
# 0. vagrant-up | |
# 1. Download the latest from http://buildwithcraft.com | |
# 2. Uncompress the Craft zip. | |
# 3. Copy its 'public' and 'craft' directories into the 'www' folder. | |
# 4. Rename www/public/htaccess to www/public/.htaccess |
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
#!/bin/bash | |
# Assignment | |
text=$@ | |
letters=("a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z" "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z") | |
blackletters=("𝔞" "𝔟" "𝔠" "𝔡" "𝔢" "𝔣" "𝔤" "𝔥" "𝔦" "𝔧" "𝔨" "𝔩" "𝔪" "𝔫" "𝔬" "𝔭" "𝔮" "𝔯" "𝔰" "𝔱" "𝔲" "𝔳" "𝔴" "𝔵" "𝔶" "𝔷" "𝔄" "𝔅" "ℭ" "𝔇" "𝔈" "𝔉" "𝔊" "ℌ" "ℑ" "𝔍" "𝔎" "𝔏" "𝔐" "𝔑" "𝔒" "𝔓" "𝔔" "ℜ" "𝔖" "𝔗" "𝔘" "𝔙" "𝔚" "𝔛" "𝔜" "ℨ") | |
for i in {1..52}; do | |
text=${text//${letters[$i]}/${blackletters[$i]}} |
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
brew install dnsmasq | |
mkdir /usr/local/etc | |
touch /usr/local/etc/dnsmasq.conf | |
echo "address=/dev/127.0.0.1\n" >> /usr/local/etc/dnsmasq.conf | |
echo "address=/vm/10.0.0.10\n" >> /usr/local/etc/dnsmasq.conf | |
sudo cp -fv /usr/local/opt/dnsmasq/*.plist /Library/LaunchDaemons | |
mkdir /etc/resolver |
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
New generations of computing devices are changing the way we interact with digital content. These shifts are usually lumped under the "mobile" banner, but that's just one facet of the new world. Forward-thinking designers, developers, and strategists need to consider all of the following (and more!) when they plan for their users. | |
Screen (This depends on the physical device, or how it's being used) | |
- Physical size | |
- Perceived size | |
- Resolution | |
- Responsiveness | |
- Fidelity | |
Alternative outputs |
NewerOlder