echo "$run" | sh
}
+mac_dev_shm() {
+ set -e
+ local mb=${1?"Usage: $FUNCNAME SIZE in MB [MOUNT DIR (default /dev/shm)]"}
+ local mount_point=${2:-/dev/shm}
+ local ramdisk_dev=$(hdiutil attach -nomount ram://$((2 * 1024 *$mb)))
+ diskutil eraseVolume HFS+ RAMDisk "${ramdisk_dev}"
+
+ install -d "${mount_point}" -m 7777
+ mount -o noatime -t hfs "${ramdisk_dev}" "${mount_point}"
+
+ echo "remove with:"
+ echo "umount ${mount_point}"
+ echo "diskutil eject ${ramdisk_dev}"
+}
+
mac_user_top_proc() {
echo "TOP PROCESSES:"
ps -Aro'%cpu, ucomm, user' | grep `whoami` | grep -v ' 0.0 '
--- /dev/null
+# use subshell for function definition
+f() {
+ set -e pipefail
+ echo a
+ false
+ echo Should NOT get HERE
+ return 0
+}
+
+f
+echo OK
class Db extends nb {
# PDO Connection
- public static $encoding = 'utf-8';
+# NB 22.09.16 public static $encoding = 'utf-8';
+
+# NB 22.09.16: TODO
+ public static $table_rows_dump = [
+ 'praser' => false,
+ ];
+
public $conn;
public $pdo;
public $options = [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]; # See: http://php.net/manual/en/pdo.error-handling.php
}
# Encoding
- if (isset($opt['encoding'])) {
- self::$encoding = $opt['encoding'];
- unset($opt['encoding']);
- }
+# NB 22.09.16 if (isset($opt['encoding'])) {
+# NB 22.09.16 self::$encoding = $opt['encoding'];
+# NB 22.09.16 unset($opt['encoding']);
+# NB 22.09.16 }
# Args into this
foreach ($opt as $k=>$v) $this->$k = $v;
return;
}
+ /*
+ * Function format
+ * format ar variable for scalar output
+ */
public static function format($v,$type=null,$conf=[]) {
if ($type === null) $type = self::type();
$is_scalar = is_scalar($v);