Ruby script to convert stops.txt
and shapes.txt
to GeoJSON.
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
{ | |
"geometry": { | |
"coordinates": [ | |
-75.16374, | |
39.95378 | |
], | |
"type": "Point" | |
}, | |
"properties": { | |
"addressStreet": "1401 John F. Kennedy Blvd.", |
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
public class StreamsTest { | |
@Test | |
public void chapter2Stream1() { | |
String contents = "catch,catching,cat,cats,dog,eating"; | |
String[] splitted = contents.split("[\\ P{ L}] +"); | |
System.out.println(splitted); | |
String[] wordsArray = { "catch", "catching", "cat", "cats", "dog", "eating"}; | |
Stream<String> stream = Arrays.stream(wordsArray, 1, wordsArray.length); |
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
def prev_month_list_based_on_1st_current_month(prev_month_range) | |
today = Date.today | |
beg_of_current_month = today - today.day + 1 | |
prev_month_range.to_a.map { | prev_month_number | beg_of_current_month.prev_month(prev_month_number) } | |
end |
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
<script> | |
evoGraphOptions = { | |
title: "Last 12 months: total days in month where elevator outage was reported <% if station %>at <%= station['stop_name'] %><% end %>", | |
data: [], | |
width: 700, | |
height: 350 | |
}; | |
$.get("/septa/elevator/outagedayslast12months/<%= station['_id'] %>", function( outageData ) { | |
$.each(outageData, function( index, value ) { | |
evoGraphOptions.data.push(value.month, value.outageDays) |
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
Query to group by a category (from shell) | |
db.products.aggregate ([ | |
{"$group": | |
{ | |
"_id":"$category", | |
"num_products":{"$sum":1} | |
}} | |
]) |
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
<!-- | |
This is an example Overpass query. | |
Try it out by pressing the Run button above! | |
You can find more examples with the Load tool. | |
--> | |
<query type="node"> | |
<has-kv k="amenity" v="cafe"/> | |
<has-kv k="wheelchair" v="yes"/> | |
<bbox-query {{bbox}}/><!--this is auto-completed with the | |
current map view coordinates.--> |