Skip to content

Instantly share code, notes, and snippets.

View kognate's full-sized avatar

Joshua Smith kognate

  • Pittsburgh, PA
View GitHub Profile
@adeel
adeel / push-notifications.clj
Created July 26, 2011 01:03
Example of sending Apple push notifications with Clojure.
; Depends on [com.notnoop.apns/apns "0.1.6"].
(:import ('com.notnoop.apns APNS))
(defn send-push-notification [device-token message]
(let [service (.build (.withSandboxDestination
(.withCert (APNS/newService) "resources/apns-dev-cert.p12" "password")))
payload (.build (.alertBody (APNS/newPayload) message))]
(.push service device-token payload)))
class TumbleDRYer
def initialize filename
@hash = Hash.new 0
@links = Hash.new 0
previous = nil
open(filename).read.scan /\w+|\W+/ do |word|
unless previous.nil?
@links[[previous,word]] += 1
end
@hash[word] += 1
package com.parallel48.galliano.thrift;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import javax.servlet.ServletException;