- Flat over nested
- Simple over complex
- Referential transparency over stateful
- Explicit over implicit/magic
- A smaller/shorter program is a better program
- Maintainability over being terse/parlour tricks
- Concrete over abstract
- Modular over monolithic; modules over frameworks/libraries
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
obj | |
len | |
arr | |
elem | |
opts | |
fn | |
acc |
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 strict'; | |
var str = 'foobarbaz'; | |
var regexp = /bar/; | |
console.log(str.match(regexp)); //=> [ 'bar', index: 3, input: 'foobarbaz' ] | |
console.log(regexp.exec(str)); //=> [ 'bar', index: 3, input: 'foobarbaz' ] | |
console.log(regexp.test(str)); //=> true |
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 | |
# File names. | |
SRC_FILE="$1.ml" | |
TEST_FILE="test.ml" | |
EXEC_FILE="test.out" | |
# Exit if no module name specified. | |
[ -z "$1" ] && echo "$0: $src: Need a module name" >&2 && exit 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
int main() { | |
int arr[2] = { 1, 2 }; | |
int* x = &arr[0]; // x = address of arr[0] | |
printf("%d, %d\n", *x, arr[0]); //=> 1, 1 | |
arr[0] = 24; | |
printf("%d, %d\n", *x, arr[0]); //=> 24, 24 | |
*x = 42; |
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
.active | |
.affix | |
.alert | |
.alert-danger | |
.alert-dismissable | |
.alert-info | |
.alert-link | |
.alert-success | |
.alert-warning | |
.arrow |
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
# SINGLE-QUOTED | |
# text between the single-quotes is read as a plain string | |
$ echo 'foo "bar" `baz`' | |
foo "bar" `baz` | |
# BACK-QUOTED | |
# text between the back-quotes is read as a command | |
$ echo `echo "foo"` | |
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
import java.util.*; | |
import java.io.*; | |
class ReadInputByCharacter { | |
public static void main(String[] args) throws Exception { | |
InputStreamReader isr = new InputStreamReader(System.in); | |
BufferedReader br = new BufferedReader(isr); |
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
function error() { | |
echo "foo: $1" | |
exit 1 | |
} | |
# loop over arguments | |
while [ $# -gt 0 ]; do | |
case "$1" in | |
# flag with value | |
-c | -r | -i | -o) |
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/sh | |
error() { | |
echo "foo: $1" | |
exit 1 | |
} | |
while [ $# -gt 0 ]; do | |
case "$1" in | |
-v) |