- why?(aka "do one thing well" / Unix Philosophy)
- npm (creating a package/consuming a package) / modular.js
- browserify
- modular CSS (using SASS or Less)
- application structure
- build tools
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
| .go-link { | |
| display: inline-block; | |
| position: relative; | |
| margin-right: 1.25em; | |
| } | |
| .go-link:after { | |
| .cf-icon; | |
| content: "\e002"; | |
| display: block; |
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
| require('console-log').show(true); | |
| var loanCalc = require('loan-calc'); | |
| // amortization table calculations | |
| // calculate the monthly payment using loan-calc | |
| // calculate the interest paid per payment | |
| // calculate remaining loan balance | |
| // calculate sum of interest payments | |
| var amortizationCalc = function(amount, rate, totalTerm, amortizeTerm) { | |
| var monthlyPayment = loanCalc.paymentCalc({amount: amount, rate:rate, termMonths: totalTerm}), |
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
| require('console-log').show(true); | |
| var Financial = require('financial'); | |
| var Money = require('accounting'); | |
| var calcPayment = function(loanRate, loanYears, loanAmt) { | |
| var monthlyPayment = Financial.PMT(loanRate / 100 / 12, loanYears * 12, loanAmt); | |
| monthlyPayment = Math.abs(monthlyPayment); | |
| return makeMoney(monthlyPayment); | |
| }; |
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
| var compare = function(a, b) { | |
| "use strict"; | |
| // iterate over each key in b | |
| for (var key in b) { | |
| // check if the key is present in a | |
| if (key in a) { | |
| // make sure a and be are not exact matches | |
| if (b[key] !== a[key]) { | |
| if (typeof b[key] === "object") { | |
| // if b[key] is an object recursively call compare |
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
| var compare = function(a, b) { | |
| "use strict"; | |
| // iterate over each key in b | |
| for (var key in b) { | |
| // check if the key is present in a | |
| if (key in a) { | |
| // make sure a and be are not exact matches | |
| if (b[key] !== a[key]) { | |
| c[key] = b[key]; // if not an exact match add to c | |
| } |
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
| var updateComparisons = function() { | |
| $('.interest-cost').each(function( index ) { | |
| var rate = $(this).siblings('.rate-compare').val(), | |
| length = parseInt($(this).find('.loan-years').text(), 10), | |
| totalInterest = interest(rate, length, details.amount), | |
| $selector = $(this).find('.new-cost'); | |
| $selector.text(totalInterest); | |
| }); | |
| }; |
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
| sudo apt-get update | |
| sudo apt-get install -y python-software-properties python g++ make | |
| sudo add-apt-repository ppa:chris-lea/node.js | |
| sudo apt-get update | |
| sudo apt-get install -y nodejs |
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
| alias go="open \`git remote -v | grep git@github.com | grep fetch | head -1 | cut -f2 | cut -d' ' -f1 | sed -e's/:/\//' -e 's/git@/http:\/\//'\`" |
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
| var Financial = require('financial'); | |
| var Money = require('accounting'); | |
| // calculate the monthly payment of a loan | |
| var calcPayment = function(loanRate, loanYears, loanAmt) { | |
| var monthlyPayment = Financial.PMT(loanRate / 100 / 12, loanYears * 12, loanAmt); | |
| return makeMoney(monthlyPayment); | |
| }; | |
| // calculate the total interest paid |