Skip to content

Instantly share code, notes, and snippets.

@screamingmunch
Last active December 19, 2015 02:28
Show Gist options
  • Save screamingmunch/5882893 to your computer and use it in GitHub Desktop.
Save screamingmunch/5882893 to your computer and use it in GitHub Desktop.
Useful Tools that we've installed and commands we use regularly..

##JavaScript

tools

  1. Install jshint and Node.js

wget https://raw.github.com/coolaj86/dotfiles/master/.jshintrc

then install node.js from http://nodejs.org/ or

https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager

finally do this: npm install -g jshint

'pushd ~'

curl https://raw.github.com/coolaj86/dotfiles/master/.jshintrc > ~/.jshintrc
wget https://raw.github.com/coolaj86/dotfiles/master/.jshintrc

cat .jshintrc

https://gist.github.com/coolaj86/5889096
  1. opening a file: on linux: xdg-open index.html
    on mac: open index.html

  2. inside the main JS function, add "use strict"; to tell jshint to use Version 5 of JavaScript

  3. make sure you have wget curl for linux: sudo apt-get install wget curl for mac: sudo chown -R whoami /usr/local/ brew install wget curl

  4. install zshell: https://github.com/robbyrussell/oh-my-zsh for linux: sudo apt-get install zsh type "which zsh" it should say: /usr/bin/zsh type "chsh -s /usr/bin/zsh" it will prompt for your password then after that, close the terminal, and log out of ubuntu and then log back in and you should be good.

commands & tricks

* `cmd option j` (mac) or `ctr shift j` (linux) while in chrome browser to open up console.
  • cmd option j (mac) or ctr shift j while in chrome browser to open up console.

##Ruby

gems & tools

1. `j@ubuntu~$ gem install pry` => This goes to rubygems.org online to download the "pry" gem
  1. gem install rspec in terminal to install rspec--

to run Rspec in terminal : rspec --color file_name_spec.rb

  1. Sinatra: gem install sinatra sinatra-contrib to install and gem list sinatra to confirm it has been installed.

ruby file_name.rb -o 0.0.0.0 for Sinatra host

commands & tricks

1. `#!/usr/bin/env ruby` then add `chmod a+x file_name.rb` in command line so you can run your program by calling `./file_name.rb` without typing ruby in front
  1. require ("./contact") the ./ part asks to look for the file contact in the current folder that you are in, or the folder where your current file where this line is written is saved. Ruby automatically knows it is looking for a .rb file, so you don't need to write the file extension. This is how you reference other files in your ruby file.

##Sublime Text

tools

  1. Sublime Linter: We've installed Sublime Linter through sublime package Control, this will give us error check while we type:

http://wbond.net/sublime_packages/package_control/installation

https://github.com/SublimeLinter/SublimeLinter

commands & tricks

  1. ctrl / auto comments everything that's high-lighted 

  2. press ctrl D while one of the word is selected will automatically select the same word throughout the document.

##Terminal

tools

1. oh-my-zsh: https://github.com/robbyrussell/oh-my-zsh

on linux machines- install zsh via "sudo apt-get install zsh" to install type which zsh to confirm it is in your home directory (for mine it's in /usr/bin/zsh) then type chsh -s /usr/bin/zsh , reopen terminal.. then viola!

commands & tricks

  1. Ctrl + to zoom in on Linux machines (in apple: Cmd +)

  2. Review of Terminal Commands: https://gist.github.com/screamingmunch/5800302

  3. While in Terminal, to get to beginning of line: Ctrl + a; to get to end of line: Ctrl + e

*for Mac- if you're running into issues opening a non-mac program, press Appl Ctrl then mouse click on the icon to open that way.

  1. Getting files from Terminal:
j@ubuntu:~$ mkdir Code/wk1d3
j@ubuntu:~$ pushd Code/wk1d3/
j@ubuntu:~/Code/wk1d3$ wget https://gist.github.com/coolaj86/983abc67071fbb5d0143/
raw/0ae2430c4bcdb1574d7e392c0e0ab2c65dc08974/instructors.csv

wget retrieves the file from your url and saves it into your 
/Code/wk1d3 folder as "instructors.csv"

j@ubuntu:~/Code/wk1d3$ cat instructors.csv
running this will display the info in your csv file
  1. in terminal: ping -c 1 www.google.com or ping -c www.yahoo.com will give you IP addresses. When you type ifconfig you'll get a list of available interfaces.

  2. find . in command line will return all the files in that folder

##Git

Git Commands

	git init
	git add . 
	git commit -m <message>
	git push <remote> <branch>
	git pull <remote> <branch>
	git clone
	git 

git init
This initializes a new git repository (a git repository, not a github repository)

git add
This adds changes you have made to the git repository

git commit -m

  • This commits (saves) the changes you've added to the repository
  • The -m is to tell git you are going to write a message then you write this message
  • You have to write a commit message to commit code

git push remote branch

  • git push pushes your code to somewhere on the cloud (on the internet)
  • remote is the web address of where you are pushing code
  • branch is the name of the branch you are pushing to (for now, just origin)

git pull remote branch

  • git pull pulls code down from the cloud (the internet)
  • remote is still the web address
  • branch is still the branch name

git clone
This copies a full repo from the cloud to your computer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment