g++ -Wall hello.cpp -o hello
This file contains 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
// 1. basic tracking code | |
var _gaq = _gaq || []; | |
_gaq.push(['_setAccount', 'UA-35559116-1']); | |
_gaq.push(['_setDomainName', 'collegecoding.com']); | |
_gaq.push(['_trackPageview']); | |
(function() { | |
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | |
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | |
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); |
This file contains 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
# stylus compile & watch | |
stylus public/style/main.styl -w & | |
npm outdated # nicest way to list installed modules | |
npm ls # list installed modules & dependencies | |
npm ls -g # list globally installed node modules | |
npm update # check for updated versions of modules in the current package | |
npm view {pkg} # view a package's published metadata | |
npm install {pkg} --save # install the latest version of a package and add it to your package.json's dependencies | |
npm install {pkg} --save-dev # install and save as a devDependency |
This file contains 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
/* COMMAND LINE */ | |
mongod & // start mongo server on port 27017 by default | |
mongo mydb // launch mongo shell using the specified database | |
// importing & exporting | |
mongoimport -d mydb -c mycollection --jsonArray --file input.json | |
mongoimport -d mydb -c mycollection --headerline --type csv --file input.csv | |
mongoexport -d mydb -c mycollection --out output.json | |
/* MONGO SHELL */ |
This file contains 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
package actionlistenerdemo; | |
import java.awt.*; | |
import java.awt.event.*; | |
import javax.swing.*; | |
// The primary class is a JFrame which can be shown when the program starts | |
public class ActionListenerDemo extends JFrame { | |
/* main is just housed inside of the primary class. It creates a new |
This file contains 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
# adding and committing | |
git add -A # stages All | |
git add . # stages new and modified, without deleted | |
git add -u # stages modified and deleted, without new | |
git commit --amend # Add staged changes to previous commit. Do not use if commit has been pushed. | |
git commit --amend --no-edit # Do so without having to edit the commit message. | |
# remotes - pushing, pulling, and tracking | |
git fetch # gets remote objects and refs. Needed if new branches were added on the remote. | |
git remote -v # Lists all remotes (verbose) |
This file contains 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
public class RecursionTest | |
{ | |
public static int calc(int n) | |
{ | |
// base case | |
if(n == 0) | |
{ | |
return 1; | |
} | |
This file contains 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
// looping over an array | |
var fruit = ["Mango", "Guanabana", "Mamoncino", "Piña"]; | |
for(var i=0; i<fruit.length; i++) { | |
console.log(fruit[i]); | |
} | |
// looping over an object | |
var students = { | |
// key : value | |
// access a value with object[key] |
This file contains 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
// all three of the below code snippets are equivalent! | |
// #1: If you notice the body of your 'if' is empty but your else has code, then convert it to #2 | |
if(A && B) | |
{ | |
// do nothing | |
} | |
else | |
{ | |
doSomething(); |
This file contains 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
/* | |
Enums are mostly for internal purposes. Think of it as a way to make your job as a developer | |
easier when you have a few predefined values and you don't want to have to remember obscure codes. | |
Let's say you have three different states in your program: 0 means INACTIVE, 1 means PENDING, and 2 | |
means ACTIVE. | |
*/ | |
// You could keep track of the state with an integer like so: | |
int programState = 1; // PENDING |
OlderNewer