]> git.nbdom.net Git - nb.git/commitdiff
remove staic Db::encoding, bash function, clean up
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 22 Sep 2016 22:33:25 +0000 (23:33 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 22 Sep 2016 22:33:25 +0000 (23:33 +0100)
etc/profile.d/mac.sh
etc/vim/templates/bashf.tt [new file with mode: 0644]
lib/php/db.php
lib/php/out.php

index 1f8869043a1e86ced936af02bf1097d1083c70d4..587b945ec7603697a918cb3f98f76c1f4211914e 100644 (file)
@@ -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 (file)
index 0000000..fbe30fc
--- /dev/null
@@ -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
index cc3e4130ebf78d275fa9dba0ccdd3b9e6ac7cf61..ad4a54f79ca890434716b4a2c276cd7bceeb47fd 100644 (file)
@@ -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;
index e73c974c4b636ec7588c34de1fcd8cba1412aa81..762d19d7ab0054c141f636da95ce7abd5206d234 100644 (file)
@@ -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);