Skip to content

Instantly share code, notes, and snippets.

View josephpconley's full-sized avatar

Joe Conley josephpconley

View GitHub Profile
/**
* User: jconley
* Date: 7/14/2014
*/
trait Db {
def name: String
}
class MySQLDb extends Db {
val name = "MySQL"
}
ws(get, http://www.avclub.com/tv/game-of-thrones-experts/).body;
xpath(this, //section[@class='article-list']).section;
tmpl(
<rss version="2.0">
<channel>
<title>AV Club Reviews for Game of Thrones (experts)</title>
<description>AV Club Reviews for Game of Thrones (experts)</description>
{{#article}}
<item>
<title>{{div.h1.title}}</title>
ws(get, http://www.swingstats.com);
mongo(<host>, <user>, <pass>, "swingstats", "save", this);
if(_.1.status != 200, email([email protected], [email protected], "SITE IS DOWN"));
ws(get, https://maps.googleapis.com/maps/api/geocode/json?address={{urlEncode "3401 Market St., Philadelphia, PA 19104"}});
this.body.results[0].geometry.location;
ws(get, "https://api.forecast.io/forecast/<apiKey>/{{lat}}, {{lng}}");
if(this.body.currently.temperature < 40, sms(<joe_cell_num>, "Bring a coat Joe!"));
@josephpconley
josephpconley / CI
Last active August 29, 2015 14:14
DIY Continuous Integration - Save this script in DataCombinator and create a repo webhook in Github pointing to that script's POST url (populate variables based on your host info)
api(post, https://api.github.com/repos/{{repository.full_name}}/statuses/{{after}}, 4,
{"state": "pending"}
);
ssh(<host>, <user>, <pass>,
"cd {{repository.name}} && git fetch origin && git checkout {{after}} && sbt test"
);
if(this.exitCode == 0,
api(post, https://api.github.com/repos/{{_.0.repository.full_name}}/statuses/{{_.0.after}}, 4,
{"state": "success"}
),
@josephpconley
josephpconley / HadoopWordCount.scala
Created October 9, 2015 15:06
Spark code for following word count text: Betty Botta bought some butter; "But," said she, "this butter's bitter! If I put it in my batter It will make my batter bitter. But a bit o' better butter Will but make my batter better." Then she bought a bit o' butter Better than the bitter butter, Made her bitter batter better. So 'twas better Betty B…
sc.textFile("hdfs://localhost/jconley/input/wc.txt").flatMap(_.trim.split("""[\s\W]+""")).map(w => w -> 1).reduceByKey(_ + _).sortBy(_._2, ascending = false).foreach(println)
@josephpconley
josephpconley / README.md
Last active December 8, 2019 16:11 — forked from mfullen/buysideAnswers.py
Please review the README.md for instructions on completing and submitting your codetest

Please fill out buysideAnswers.py so that all the tests in buyside_test.py pass. Submit your entire project zipped via email or provide a link to a Github repo. Please provide instructions on how to run in a README.md, with any additional comments or feedback.

Thanks!