Skip to content

Instantly share code, notes, and snippets.

View RadoBuransky's full-sized avatar

Rado Buranský RadoBuransky

View GitHub Profile
@fredhsu
fredhsu / twitterdump.java
Created September 11, 2011 23:36
Twitter stream to MongoDB
import com.mongodb.*;
import com.mongodb.util.JSON;
import twitter4j.TwitterException;
import twitter4j.TwitterStream;
import twitter4j.TwitterStreamFactory;
import twitter4j.StatusListener;
import twitter4j.Status;
import twitter4j.StatusDeletionNotice;
import twitter4j.internal.org.json.JSONObject;
import twitter4j.json.DataObjectFactory;
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@derekwyatt
derekwyatt / Master.scala
Created August 7, 2012 18:36
The Master code in the Master / Worker remote node dispatch pattern
class Master extends Actor with ActorLogging {
import MasterWorkerProtocol._
import scala.collection.mutable.{Map, Queue}
// Holds known workers and what they may be working on
val workers = Map.empty[ActorRef, Option[Tuple2[ActorRef, Any]]]
// Holds the incoming list of work to be done as well
// as the memory of who asked for it
val workQ = Queue.empty[Tuple2[ActorRef, Any]]
@RadoBuransky
RadoBuransky / dist-play-app-initd
Last active March 24, 2020 20:26
Init.d shell script for Play framework distributed application. Provides start, stop, restart and status commands to control applications packaged using standard "play dist" packaging command.
#!/bin/bash
#
# =========================================================================
# Copyright 2014 Rado Buransky, Dominion Marine Media
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@jto
jto / qs.scala
Last active December 9, 2019 07:14
Type level quicksort
object jto {
type _1 = Succ[_0]
type _2 = Succ[_1]
type _3 = Succ[_2]
type _4 = Succ[_3]
type _5 = Succ[_4]
// Natural numbers (extracted from shapeless)