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
def build_portfolio | |
# preparing portfolio data for charts | |
stocks, eps, pm, industries, price_performance = [], [], [], {}, [] | |
Portfolio.first.portfolio_companies.each do |pc| | |
# create arrays from data | |
stocks << pc.company.symbol if pc.company.symbol | |
eps << pc.company.diluted_eps if pc.company.diluted_eps | |
pm << (pc.company.profit_margin*100).round(1) if pc.company.profit_margin |
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
var PortfolioBuilder = function() { | |
var $context = ""; | |
var symbols = []; | |
var that = this; | |
return{ | |
init: function(context) { | |
$context = $(context); | |
this.initSymbols(); | |
this.updateButtons(); |
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
### Getting entries from my blog (Posterous) | |
getBlogPosts = -> | |
req = $.ajax 'http://query.yahooapis.com/v1/public/yql', | |
jsonp:'callback' | |
dataType:'jsonp' | |
data: | |
q: "select channel.item.title, channel.item.pubDate, | |
channel.item.link from xml where | |
url = 'http://blog.jrmoran.com/rss' limit 6" | |
format: 'json' |
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
var res = ({ | |
query:{ | |
"count": 3, | |
"created": "2011-02-28T07:15:39Z", | |
"lang": "en-US", | |
"results": { | |
"rss": [{ | |
"channel": { | |
"item": { | |
"title": "Post 1 Title", |
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
/* | |
Excenlente, | |
unas observaciones. | |
*/ | |
var items = | |
Array( | |
{ valor:"A", probabilidad: (5/10) }, | |
{ valor:"B", probabilidad: (1/10) }, |
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
# These are my notes from the PragProg book on CoffeeScript of things that either | |
# aren't in the main CS language reference or I didn't pick them up there. I wrote | |
# them down before I forgot, and put it here for others but mainly as a reference for | |
# myself. | |
# assign arguments in constructor to properties of the same name: | |
class Thingie | |
constructor: (@name, @url) -> | |
# is the same as: |
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
;; Jaime Moran 2011 | |
(ns parser | |
(:use [clojure.contrib.duck-streams :only (read-lines)] | |
clojure.contrib.json)) | |
;; This processes a CSV file, with all energy consumption data from | |
;; 1960-2009 accross all US states | |
;; | |
;; MSN,StateCode,Year,Data |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.0.0"></script> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.csv.js?2.0.0"></script> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.time.js?2.0.0"></script> | |
<style type="text/css"> | |
body { | |
font: 10px sans-serif; |
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
date | wounds | other | disease | |
---|---|---|---|---|
5/1854 | 0 | 95 | 105 | |
6/1854 | 0 | 40 | 95 | |
7/1854 | 0 | 140 | 520 | |
8/1854 | 20 | 150 | 800 | |
9/1854 | 220 | 230 | 740 | |
10/1854 | 305 | 310 | 600 | |
11/1854 | 480 | 290 | 820 | |
12/1854 | 295 | 310 | 1100 | |
1/1855 | 230 | 460 | 1440 |
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
/* | |
DUI = 00016297-5 | |
Posiciones -> 9 8 7 6 5 4 3 2 | |
DUI -> 0 0 0 1 6 2 9 7 | |
DV = 5 | |
sum: (9*0) + (8*0) + (7*0) + (6*1) + (5*6) + (4*2) + (3*9) + (2*7) = 85 | |
residuo: (85 % 10) = 5 | |
resta: 10 - residuo = 5 |
OlderNewer