(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| function printHierarchy(node, padding="") { | |
| let newPadding = padding; | |
| if (node.name) { | |
| newPadding += " |"; | |
| console.log(`${padding}-${node.name}`); | |
| } | |
| node.children.forEach(child => printHierarchy(child, newPadding)); | |
| } |
| #!/bin/bash | |
| #this script was written to be called with find, something like: | |
| # find . -type f \( -name *.jpg -o -name *.png -o -name *.JPG -o -name *.PNG \) -exec ~/batchImageOptim.sh "{}" \; | |
| if [[ $# == 1 ]]; then | |
| input_file="$1" | |
| else | |
| echo "no arguments, no party" | |
| exit 255 |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| import javax.crypto.Cipher; | |
| import java.security.NoSuchAlgorithmException; | |
| public class KeyLengthDetector { | |
| public static void main(String[] args) { | |
| int allowedKeyLength = 0; | |
| try { | |
| allowedKeyLength = Cipher.getMaxAllowedKeyLength("AES"); | |
| } catch (NoSuchAlgorithmException e) { |
| Groovy also has a Time Category class which gives you DSL style syntax for manipulating dates. Here is an example: | |
| import org.codehaus.groovy.runtime.TimeCategory | |
| now = new Date() | |
| println now | |
| use(TimeCategory) { | |
| footballPractice = now + 1.week - 4.days + 2.hours - 3.seconds | |
| } | |
| println footballPractice | |
| which will produce output like this: |