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
class SetupDayData | |
attr_reader :iterations | |
def go | |
@day = nil | |
this_day = Startup.order(:al_created_at).first.al_created_at |
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
#controller method example | |
def us_map | |
@locations = LocationNode.where(:in_the_us => true).where('d_s > ?', 10) | |
end | |
#example of view | |
<h1>US Map of Startup Density</h1> |
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 'open-uri' | |
require 'csv' | |
class YahooFinance | |
# VERSION = '0.1.0' | |
COLUMNS = { | |
:ask => "a", | |
:average_daily_volume => "a2", |
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
getCIK = function(ticker) { | |
stopifnot(is.character(ticker)) | |
uri = "http://www.sec.gov/cgi-bin/browse-edgar" | |
response = getForm(uri,CIK=ticker,action="getcompany") | |
html = htmlParse(response) | |
CIKNode = getNodeSet(html, "//acronym[@title=\"Central Index Key\"][text() = \"CIK\"]") | |
CIKNodeText = sapply(CIKNode, function(x) xmlValue(getSibling(getSibling(x)))) | |
CIK = sub(" .*","",CIKNodeText) | |
CIK = sub("^0*","",CIK) |
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 'open-uri' | |
class GetSingleHistoricalPrice | |
def initialize | |
@month_thing = { "1" => "00", "2" => "01", "3" => "02", "4" => "03", "5" => "04", "6" => "05", "7" => "06", "8" => "07", "9" => "08", "10" => "09", "11" => "10", "12" => "11" } | |
end | |
def get_all_day_prices | |
Day.where(:already => false).each do |d| | |
begin |
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
#!/bin/bash | |
# | |
# Install Postgres 9.1, PostGIS 2.0 and pgRouting on a clean Ubuntu 12.04 install (64 bit) | |
# updated to PostGIS 2.0.1 | |
# basics | |
apt-get install python-software-properties | |
apt-add-repository ppa:sharpie/for-science # To get GEOS 3.3.3 | |
# install the following pacakages |
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
FOR MAC | |
- download and install Postgres.app, version 9.2.2.0 only! | |
(get here: http://postgres-app.s3.amazonaws.com/PostgresApp-9-2-2-0.zip <= link | |
from this: https://github.com/PostgresApp/PostgresApp/issues/109) | |
- add to ~/.bash_profile: | |
export PGHOST=localhost | |
- run: | |
gem uninstall pg (if already there) | |
gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config |
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
gem install pyqt | |
add the below to ~/.bash_profile | |
export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH | |
brew tap homebrew/science | |
brew install qgis --with-grass --with-postgis |
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
To get PostGIS running on mac with postgres.app on rails---- | |
- update XCode | |
- brew install postgis | |
- gem install rgeo -- --with-geos-dir=/usr/lib | |
- database.yml should look like: | |
development: | |
adapter: postgis | |
encoding: unicode | |
postgis_extension: true |
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
ln -s /Applications/TextMate.app/Contents/SharedSupport/Support/bin/mate /usr/local/bin/mate |