syntax.us Let the syntax do the talking
Blog Contact Posts Questions Tags Hire Me

Question:
What is 2015_1101 Code Challenge?

The 2015_1101 Code Challenge is a learning exercise for students attending Dan's Linux JavaScript Class at 3pm on 2015-11-01 at Hacker Dojo:

http://www.meetup.com/Dans-Linux-JavaScript-Class/events/225904599/

We start with three tasks: Install Ubuntu, enhance it, and create account named ann: Next, we learn some Emacs:
  • emacs ~ann/.emacs
  • Experiment with the controls at the top of the emacs window
  • Add this syntax to file: ~ann/.emacs
    ;;
    ;; ~ann/.emacs
    ;;
    (global-set-key "\C-xs" 'shell)
    (global-set-key "\em"   'buffer-menu-other-window)
    (global-set-key "\eR"   'rename-buffer)
    ;; end of .emacs
    
  • Figure out how to save and exit
  • Verify your work:
    cat ~ann/.emacs
  • Start 'bare' emacs:
    emacs
  • Start a shell in emacs with ctrl-x then letter 's'.
  • I should see something like this:
  • Rename the shell to SHELL1 with esc-key, then letter 'R'
  • I should see something like this:
  • List all buffers in my emacs with esc-key, then letter 'm'
  • I should see something like this:

I see the buffer-menu as similar to the Mac-Dock, Ubuntu-Launcher or the Windows-Taskbar.

The buffer-menu is my favorite emacs feature; it allows my mind to QUICKLY switch focus among three types of objects:
  • different shells
  • different files
  • different folders

The buffer-menu floats 'hot' shells, files and folders to the top.

This is useful behavior.

I mostly do 4 types of tasks on a laptop:
  • Interact with file
  • Interact with folder
  • Interact with shell
  • Interact with browser

I can do the first three types inside of emacs.

When I coordinate tasks with emacs rather than a Dock, I work much faster (because of the buffer-menu).

That sequence of creating a shell, and renaming it is the most difficult task I need to know.

All other emacs tasks can be done using mouse and arrow keys.

If I am an emacs power-user, I know two ways to use emacs to interact with folders.

The GUI-way is to click on the file-cabinet at the top.

Another way, which is quicker, is to type command ctrl-x then letter 'f'.

I should see something like this:


  • After I learn some Emacs or some other editor, I Install Node.js in this folder: ~ann/node/
  • cd ~ann
    wget https://nodejs.org/dist/v5.0.0/node-v5.0.0-linux-x64.tar.gz
    tar zxf node-v5.0.0-linux-x64.tar.gz
    rm -rf node
    mv node-v5.0.0-linux-x64 node
  • Then, I add Node.js to PATH:
    export       PATH="/home/ann/node/bin:${PATH}"
    echo 'export PATH="/home/ann/node/bin:${PATH}"' >> ~ann/.bashrc
  • Run a test:
    which node
    node -e 'console.log("hello world")'
  • Install CoffeScript to test npm:
    which npm
    npm install -g coffee-script
    ls -la /home/ann/node/lib/node_modules/
    which coffee
    coffee -e 'console.log "hello coffee!"'
  • Start work on an app:
    cd ~ann
    echo 'gem: --no-ri --no-rdoc' >> ~ann/.gemrc
    rm -rf app25r
    git clone https://github.com/danbikle/app25r.git
    cd ~ann/app25r
    .  ~ann/app25r/app25r.bash
    rm -rf   $GEM_HOME
    mkdir -p $GEM_HOME
    /usr/bin/gem install bundler
    $GEM_HOME/bin/bundle install
    ~ann/app25r/bin/rake db:migrate
    ~ann/app25r/bin/rails r ~ann/app25r/db/csv2cars.rb
    ~ann/app25r/bin/rails s -p 3325
    /usr/bin/curl localhost:3325|head


If you want to deploy this repository to Heroku, follow this recipe:
  • Create an account at heroku.com website
  • Download/Install Heroku client
    cd ~ann
    wget https://s3.amazonaws.com/assets.heroku.com/heroku-client/heroku-client.tgz
    tar zxf heroku-client.tgz
    echo 'export PATH=/home/ann/heroku-client/bin:${PATH}' >> ~ann/.bashrc
    echo  export PATH=/home/ann/heroku-client/bin:${PATH}
  • I created ssh-key for ann account (assuming ann has none yet):
    ann@dev06:~$ 
    ann@dev06:~$ ssh-keygen -t rsa
    Generating public/private rsa key pair.
    Enter file in which to save the key (/home/ann/.ssh/id_rsa): 
    Created directory '/home/ann/.ssh'.
    Enter passphrase (empty for no passphrase): 
    Enter same passphrase again: 
    Your identification has been saved in /home/ann/.ssh/id_rsa.
    Your public key has been saved in /home/ann/.ssh/id_rsa.pub.
    The key fingerprint is:
    7c:73:e0:26:8b:62:f6:a4:1d:78:22:e5:cd:3a:5c:eb ann@dev06
    The key randomart image is:
    +--[ RSA 2048]----+
    |                 |
    |                 |
    |          .      |
    |       . . .     |
    |    .   S = .    |
    |   o +.. = o     |
    |  ..B.B..        |
    |   +oX..         |
    |    ooE          |
    +-----------------+
    ann@dev06:~$ 
    ann@dev06:~$ 
    ann@dev06:~$ 
    
  • I used heroku-client to "login" my shell. I gave a copy of ann public ssh-key to heroku:
    heroku status
    heroku auth:login
    heroku auth:whoami
    heroku keys:add
  • I used heroku-client to create a blank app named rails411 at herokuapp.com
    cd ~ann/app25r
    ~ann/heroku-client/bin/heroku create rails411
  • git-push ~ann/app25r to heroku
    cd ~ann/app25r
    git add .
    git commit -am rails
    git push heroku master
  • Setup the database on heroku for my Rails app there:
    ~ann/heroku-client/bin/heroku run rake db:migrate
    ~ann/heroku-client/bin/heroku run bin/rails r db/csv2cars.rb
  • I saw ~ann/app25r deployed at https://rails411.herokuapp.com

Questions

http://www.google.com/search?q=Do+I+need+an+ssh-key+to+clone+a+Git+repository?

http://www.google.com/search?q=What+kind+of+files+reside+in+GEM_HOME?

http://www.google.com/search?q=Which+shell+command(s)+place+files+in+GEM_HOME?

http://www.google.com/search?q=Does+Node.js+have+a+folder+like+GEM_HOME?

http://www.google.com/search?q=What+is+the+intent+behind+using+GEM_HOME?

http://www.google.com/search?q=What+is+bundler?

http://www.google.com/search?q=What+does+bundle+install+do?

http://www.google.com/search?q=Which+file+does+bundle+depend+upon?

http://www.google.com/search?q=Does+Node.js+have+a+command+like+the+bundle+command?

http://www.google.com/search?q=Does+Node.js+have+a+command+like+the+gem+command?

http://www.google.com/search?q=How+to+create+a+new+Node.js+app?

http://www.google.com/search?q=How+to+create+a+new+Rails+app?

http://www.google.com/search?q=Rails+uses+which+languages?

http://www.google.com/search?q=Which+folders+do+I+see+in+a+Rails+app?

http://www.google.com/search?q=Does+a+Rails+App+depend+on+Node.js?

http://www.google.com/search?q=In+Rails+what+does+the+rake+command+do?

http://www.google.com/search?q=In+Rails+what+does+rake+db:migrate+do?

http://www.google.com/search?q=In+Rails+how+to+specify+a+database+for+the+app?

http://www.google.com/search?q=In+Ubuntu+how+to+CRUD+a+sqlite3+database?

http://www.google.com/search?q=In+Ubuntu+how+to+CRUD+a+Postgres+database?

http://www.google.com/search?q=On+my+laptop+should+I+use+sqlite3+or+Postgres?

http://www.google.com/search?q=In+Rails+how+to+CRUD+a+table+in+the+app-database?

http://www.google.com/search?q=In+Rails+how+to+CRUD+a+row+in+a+database+table?

http://www.google.com/search?q=In+Rails+how+to+copy+a+CSV+file+into+a+database+table?

http://www.google.com/search?q=What+kind+of+webserver+does+Rails+use?

http://www.google.com/search?q=How+to+install+the+webserver+used+by+Rails?

http://www.google.com/search?q=How+to+start+the+webserver+used+by+Rails?

http://www.google.com/search?q=How+to+see+status+of+webserver+used+by+Rails?

http://www.google.com/search?q=In+Rails+what+is+a+Route?

http://www.google.com/search?q=In+Rails+how+to+CRUD+routes?

http://www.google.com/search?q=In+Rails+routing+what+is+a+path?

http://www.google.com/search?q=In+Rails+routing+what+is+a+parameter?

http://www.google.com/search?q=In+Rails+what+is+a+controller?

http://www.google.com/search?q=In+Rails+routing+what+is+a+controller?

http://www.google.com/search?q=In+Rails+routing+what+is+an+action?

http://www.google.com/search?q=In+Rails+how+to+CRUD+controllers?

http://www.google.com/search?q=In+Rails+how+to+copy+data+from+browser+into+controller?

http://www.google.com/search?q=In+Rails+how+to+copy+data+from+controller+into+browser?

http://www.google.com/search?q=In+Rails+what+is+a+view?

http://www.google.com/search?q=Which+languages+can+I+build+a+Rails+View+from?

http://www.google.com/search?q=In+Rails+how+to+CRUD+views?

http://www.google.com/search?q=In+Rails+how+to+copy+data+from+browser+into+View?

http://www.google.com/search?q=In+Rails+how+to+copy+data+from+View+into+browser?

http://www.google.com/search?q=In+Rails+how+to+copy+data+between+controller+and+View?

http://www.google.com/search?q=In+Rails+what+is+a+Model?

http://www.google.com/search?q=In+Rails+how+to+CRUD+Models?

http://www.google.com/search?q=In+Rails+how+to+copy+data+between+Model+and+database?

http://www.google.com/search?q=In+Rails+how+to+copy+data+between+Model,+controller,+and+view?

http://www.google.com/search?q=In+Rails+how+to+serve+JavaScript+to+browser?

http://www.google.com/search?q=In+Rails+how+to+serve+JSON+to+browser?

http://www.google.com/search?q=In+D3.js+how+to+use+Rails+as+API+server?
That could be considered an adequate code challenge for a two hour Meetup.

If you have questions, e-me:

bikle101@gmail.com


syntax.us Let the syntax do the talking
Blog Contact Posts Questions Tags Hire Me