This file contains hidden or 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 | |
| function __setup() { | |
| input="$1"; | |
| # https://stackoverflow.com/a/32584935/1993020 | |
| OUTPUT_PREFIX=$(echo $input | rev | cut -f 2- -d'.' | rev); | |
| header=$(head -1 $input); | 
  
    
      This file contains hidden or 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
    
  
  
    
  | // on node console: (on Feb 14th 2019) | |
| > let date = new Date(); | |
| > date.toLocaleDateString("en-IN", {day: "2-digit", month: "2-digit", year: "numeric"}); | |
| '02/14/2019' | |
| // Expected result: '14/02/2019' | |
| // Github issue (https://github.com/nodejs/node/issues/8500) details the behaviour & provides solutions | |
| // Easiest solution: https://github.com/nodejs/node/issues/8500#issuecomment-246437933 | |
| // | 
  
    
      This file contains hidden or 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
    
  
  
    
  | /* | |
| Retain original behaviour of new Date(), new Date("YYYY-MM-DD"), new Date(date /* Date */), | |
| while allowing instantiation using new AppointmentDate("DD.MM.YYYY") | |
| */ | |
| class AppointmentDay extends Date { | |
| constructor(date?: string | Date) { | |
| if (!date) { | |
| super(); | |
| } else if (date instanceof Date) { | |
| super(date); | 
  
    
      This file contains hidden or 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
    
  
  
    
  | $ time echo 'exit' | bash -li | |
| $ exit | |
| logout | |
| real 0m0.370s | |
| user 0m0.180s | |
| sys 0m0.268s | 
  
    
      This file contains hidden or 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
    
  
  
    
  | $ time echo 'exit' | bash -li | |
| $ exit | |
| logout | |
| real 0m3.076s | |
| user 0m1.287s | |
| sys 0m1.107s | 
  
    
      This file contains hidden or 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
    
  
  
    
  | MACOS_RUBY_DIR="/System/Library/Frameworks/Ruby.framework/Versions/Current" | |
| binaries=$(ls ${MACOS_RUBY_DIR}/usr/bin) | |
| for binary in $binaries; do | |
| source /dev/stdin <<EOF | |
| function ${binary}() { | |
| for t in ${binaries}; do | |
| unset -f "\$t"; | |
| done | |
| local SCRIPT="\$HOME/.rvm/scripts/rvm" | 
  
    
      This file contains hidden or 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 ruby() { | |
| unset -f "ruby"; | |
| local SCRIPT="$HOME/.rvm/scripts/rvm" | |
| [[ -s ${SCRIPT} ]] && source ${SCRIPT}; | |
| ruby "$@"; | |
| } | 
  
    
      This file contains hidden or 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
    
  
  
    
  | $ time rvm - version # first invocation of rvm | |
| rvm 1.29.4 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io] | |
| real 0m0.677s | |
| user 0m0.333s | |
| sys 0m0.280s | |
| $ time rvm - version # not first invocation of rvm | |
| rvm 1.29.4 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io] | 
  
    
      This file contains hidden or 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 rvm() { | |
| unset -f "rvm"; | |
| local SCRIPT="$HOME/.rvm/scripts/rvm" | |
| [[ -s ${SCRIPT} ]] && source ${SCRIPT}; | |
| rvm "$@"; | |
| } | 
  
    
      This file contains hidden or 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
    
  
  
    
  | $ time echo 'exit' | bash -li | |
| $ exit | |
| logout | |
| real 0m0.039s | |
| user 0m0.009s | |
| sys 0m0.020s |