This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
def create(userId: String, feedItemId: String) { | |
println("user: "+userId + " clipou: "+feedItemId) | |
redisClientPool.withClient { implicit client => | |
val itemsAdded = addItemToClips(userId, feedItemId) | |
if (itemsAdded != 0) { | |
addClipToTimeline(userId, feedItemId) | |
userFollowersSet(userId).flatten { followersIds => | |
addClipToTimeline(userId, feedItemId) | |
} | |
} |
def create(userId: String, feedItemId: String) { | |
println("user: "+userId + " clipou: "+feedItemId) | |
redisClientPool.withClient { client => | |
val itemsAdded = addItemToClips(redis, userId, feedItemId) | |
if (itemsAdded != 0) { | |
addClipToTimeline(client, userId, feedItemId) | |
userFollowersSet(client, userId) match { | |
case Some(followersIds) => followersIds.flatten { followerId => | |
addClipToTimeline(client, userId, feedItemId) | |
} |
val Regex = """\(([0-9]+),[0-9]+,'([^']+)','[^']*',[0-9]+,[0-9]+,[0-9]+,[0-9.]+,'[0-9]+',[0-9]+,[0-9]+,[0-9]+\)""".r | |
io.Source.fromFile("ptwiki-20120126-page.sql").getLines().foreach { line => | |
Regex.findAllIn(line).foreach { | |
case Regex(id, title) => println(id + " :: "+title) | |
} | |
} |
[2012-02-08 20:11:02,128][DEBUG][action.search.type ] [Caprice] [suggest][0], node[JV4DgCKsTmaSXAAO_p6a1g], [R], s[STARTED]: Failed to execute [org.elasticsearch.action.search.SearchRequest@5aad39c3] | |
org.elasticsearch.transport.RemoteTransportException: [Eric the Red][inet[/10.70.69.80:9300]][search/phase/query+fetch] | |
Caused by: java.lang.IllegalArgumentException | |
at java.nio.Buffer.limit(Buffer.java:249) | |
at org.apache.lucene.store.NIOFSDirectory$NIOFSIndexInput.readInternal(NIOFSDirectory.java:123) | |
at org.apache.lucene.store.BufferedIndexInput.refill(BufferedIndexInput.java:213) | |
at org.apache.lucene.store.BufferedIndexInput.readByte(BufferedIndexInput.java:39) | |
at org.apache.lucene.store.DataInput.readInt(DataInput.java:84) | |
at org.apache.lucene.store.BufferedIndexInput.readInt(BufferedIndexInput.java:153) | |
at org.apache.lucene.store.DataInput.readLong(DataInput.java:126) |
private def wikiTitles() = io.Source.fromFile(wikiTitlesDumpFile).getLines() | |
def retrieveAndIndex() { | |
val titles = wikiTitles().filter( titleIsUsable(_) ).map( cleanLine(_) ).toSet | |
for (title <- titles) { | |
val q = textPhraseQuery("_all", title) | |
val request = esClient.prepareSearch(buskIndex) | |
.setQuery(q).execute().actionGet() | |
val totalHits = request.hits().totalHits() |
git log | grep 'Author' | sed 's/<.*>//g' | sed 's/Author: //g' | sort | uniq | xargs -I {} bash -c "echo -n \"{}= \" ; git log -p --author='{}' --oneline | grep -c -e '^[+-]'" | sort -t '=' -g -k 2 -r |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer