Archive for the ‘Beyond’ Category

053. Maximum Subarray #leetcode #java #python3 #javascript #ruby #golang #scala #easy

January 25, 2018 Leave a comment





Built-in web server python 3.x

December 11, 2017 Leave a comment

python -m http.server [portNo]

re-clone git

December 7, 2017 Leave a comment

GIT=$(git rev-parse --show-toplevel)
cd $GIT/..
rm -rf $GIT
git clone ...

Categories: Beyond, git

Built-in web server python 2.7

October 18, 2017 Leave a comment

The next command helps you to create a simple http server to test anything fast, or use that location and their resources with a different port.
Just navigate in the command line to the location and type the next:

python -m SimpleHTTPServer [port]
Categories: Beyond, Mini-tips, Python, Tips

Fixing: Error: Couldn’t find preset “latest” relative to directory

July 22, 2017 Leave a comment

Add the babel-preset-latest to the node_modules of the project directory with –save-dev option, in example:
npm install –save-dev babel-preset-latest

PD. This issue came up when configuring webpack on a project recently created from scratch, and configured the babel-loader with the latest as preset.

Command npm to check for installed packages

July 22, 2017 Leave a comment

npm list -g –depth=0

CodeFights MZbot AllianceVsMonster – Ruby

June 7, 2017 Leave a comment
def allianceVersusMonster hp, ad
    mHp = hp[0]
    mAd = ad[0]
    turns = []
    size = hp.size - 1
    ( do |x|
        turns <= mAd && cHp >= mHp
        timesToDie = ( mHp / cAd.to_f).ceil
        timesIDie = ( cHp / mAd.to_f).ceil
        return size if timesIDie >= timesToDie
        mHp -= (timesIDie - 1) * cAd 
        w[1] = cHp % mAd + 1
    #fight until dead
    turns.each do |w|
        cAd, cHp = w
        return size if cAd >= mAd && cHp >= mHp       
        while cHp > 0 && mHp > 0
            mHp -= cAd
            return size if mHp <= 0
            cHp -= mAd
        size -= 1