From: Nicolas Boisselier Date: Thu, 22 Sep 2016 22:33:25 +0000 (+0100) Subject: remove staic Db::encoding, bash function, clean up X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=ddf030e8a0691d0a0193f41fe821de95591110e2;p=nb.git remove staic Db::encoding, bash function, clean up --- diff --git a/etc/profile.d/mac.sh b/etc/profile.d/mac.sh index 1f886904..587b945e 100644 --- a/etc/profile.d/mac.sh +++ b/etc/profile.d/mac.sh @@ -57,6 +57,21 @@ defaults write com.apple.finder AppleShowAllFiles FALSE 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 ' diff --git a/etc/vim/templates/bashf.tt b/etc/vim/templates/bashf.tt new file mode 100644 index 00000000..fbe30fc6 --- /dev/null +++ b/etc/vim/templates/bashf.tt @@ -0,0 +1,11 @@ +# use subshell for function definition +f() { + set -e pipefail + echo a + false + echo Should NOT get HERE + return 0 +} + +f +echo OK diff --git a/lib/php/db.php b/lib/php/db.php index cc3e4130..ad4a54f7 100644 --- a/lib/php/db.php +++ b/lib/php/db.php @@ -17,7 +17,13 @@ $DB_TYPES = []; # See db/types/*.php 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 @@ -101,10 +107,10 @@ class Db extends nb { } # 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; diff --git a/lib/php/out.php b/lib/php/out.php index e73c974c..762d19d7 100644 --- a/lib/php/out.php +++ b/lib/php/out.php @@ -346,6 +346,10 @@ Class Out extends Nb { 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);