Skip to content

Instantly share code, notes, and snippets.

/* http://nanobar.micronube.com/ || https://github.com/jacoborus/nanobar/ MIT LICENSE */
var Nanobar = (function () {
'use strict';
var addCss, animation, transEvent, createBar, Nanobar,
css = '.nanobar{float:left;width:100%;height:4px;z-index:9999;}.nanobarbar{width:0;height:100%;float:left;transition:all .3s;}',
head = document.head || document.getElementsByTagName( 'head' )[0];
// Create and insert style element in head if not exists
total = 0
RATE_OF_RETURN = 0.10
for i in range(1, 11, 2):
total += 23000 * ((1 + RATE_OF_RETURN) ** i)
# total in Roth IRA after 5 years
print total
# just earnings
print total - (5 * 23000)
@eupharis
eupharis / angular-resolve.js
Created December 8, 2014 23:56
Example of angular resolve with "class" resolve and ensuring data is current on every route change.
(function() {
"use strict";
angular.module('JobListingApp')
.config(['$routeProvider', function($routeProvider) {
// ListingRoute "class" to ensure that all routes have
// current data in JobListings before they execute a route's controllers
var ListingRoute = function(params) {
angular.extend(this, params);
};
/*ELOQUENT JAVASCRIPT*/
// forEach
function forEach(array, action) {
for (var i = 0; i < array.length; i++)
action(array[i]);
}
// map
function map(func, array) {
var result = [];
function! TrimWhiteSpace()
%s/\s\+$//e
endfunction
autocmd BufWritePre * :call TrimWhiteSpace()
function TrimEndLines()
let save_cursor = getpos(".")
:silent! %s#\($\n\s*\)\+\%$##
call setpos('.', save_cursor)
endfunction
# ~/.virtualenvs/circus/bin/postactivate
#! /bin/bash
export BASE_URL="http://localhost:8000"
export DJANGO_SETTINGS_MODULE="circus.settings"
# ~/.virtualenvs/postdeactivate
#! /bin/bash
unset BASE_URL
unset DJANGO_SETTINGS_MODULE
<!--[if lte IE 8]>
{% if DEVELOPMENT %}
<script type="text/javascript" src="https://getfirebug.com/releases/lite/1.3/firebug-lite.js"></script>
{% endif %}
<![endif]-->
# where user_roles is an array filled with strings
# option's value and text will both be role
<select ng-model="selectedUser.role" ng-options="role for role in user_roles">
</select>
# where supported_languages is an array filled with objects
# option's value will be language.code and option's text will be language.label
<select ng-model="selectedUser.language_code"
watch: {
scripts: {
files: [js + '/**/*.js'],
tasks: ['concat:js'],
},
handlebars: {
files: ['templates/**/*.hbs'],
tasks: ['handlebars'],
},
css: {
<!doctype html>
<html xmlns:ng="http://angularjs.org">
<script src="http://code.angularjs.org/angular.js"></script>
<body>
<div id="angular-free">
I am a completely inert {{double-curly}}. Angular can't touch this!
Free to do whatever jQuery craziness strikes your fancy.
Or hell, add a backbone app here.
</div>
<!-- don't add ng-app="angular-app" - that's what kicks off auto-bootstrapping!!! -->