#Mac OS X
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
<?php | |
$ceiling = 600851475143; | |
$factor = -1; | |
for ($i = 1; $i < sqrt($ceiling); $i += 2) { | |
$factor = getLargestFactor($i); | |
if ($factor == 1) { | |
primeList($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
#!upstart | |
description "appname" | |
author "authorname" | |
start on (local-filesystems and net-device-up IFACE=eth0) | |
stop on shutdown | |
respawn # restart when job dies | |
respawn limit 5 60 # give up after 5 respawns in 60 seconds |
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 |
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
#!/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
# -*- 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
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
// 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) { ... } |
OlderNewer