Ping seymores

View gist:6208758
1 2 3 4 5 6 7 8 9 10
This is all you need to know about Clojure’s namespace declarations:
 
(ns my-project.core
; :require Clojure libs
(:require clojure.core.async
[compojure.core :refer [POST routes]]
[compojure.handler :refer :all]
[ring.adapter.jetty :as jetty]
[clojure.edn :as edn :refer [read]])
; :import for Java classes
View gist:5972209
1 2 3 4 5 6 7 8 9 10
 
#http://durdn.com/blog/2012/11/22/must-have-git-aliases-advanced-examples/
[alias]
co = checkout
br = branch
ci = commit
st = status
last = log -1 HEAD
visual = !gitk
l = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
View haze-api.clj
1 2 3 4 5 6 7 8 9 10
(ns haze-api.core
(:require [net.cgrand.enlive-html :as html])
(:gen-class))
 
(def doe-url "http://apims.doe.gov.my/apims/hourly2.php")
 
(defn rows-by-enlive
[url]
(let [site (html/html-resource (java.net.URL. url))
rows (html/select site [:table.table1 :tr])]
View haze-api.groovy
1 2 3 4 5 6 7 8 9 10
import org.jsoup.*
 
String URL = "http://apims.doe.gov.my/apims/hourly2.php"
 
def doc = Jsoup.connect(URL).get();
def result = doc.select("table.table1 tr");
 
result.each { tr ->
def row = tr.select("td")
println " ---- row---\n" + row[0].text() + " " + row[1].text()
View gcm-clojure.clj
1 2 3 4 5 6 7 8 9 10
;;; Project here: https://github.com/seymores/gcm-clj
;;;
;;; Note: you need to specify the custom repo to get gcm-server.jar
;;; :repositories [["google" "https://github.com/slorber/gcm-server-repository/raw/master/releases"]]
;;; :dependencies [[com.google.android.gcm/gcm-server "1.0.2"]]
;;;
;;; See http://developer.android.com/google/gcm/gs.html#server-app
 
;; Import all the needed classes from gcm-server.jar
(import (com.google.android.gcm.server Sender Message Message$Builder MulticastResult))
View AndroidManifestDecompressor.groovy
1 2 3 4 5 6 7 8 9 10
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
class AndroidXMLDecompress {
// decompressXML -- Parse the 'compressed' binary form of Android XML docs
// such as for AndroidManifest.xml in .apk files
View IrcClient.scala
1 2 3 4 5 6 7 8 9 10
import java.net._
import java.io._
import scala.io._
import scala.util.control.Breaks._
 
val server = "irc.freenode.net";
val nick = "SeymourCakes"
val login = "SeymourCakesBot"
val channel = "#myoss"
val socket = new Socket(server, 6667)
View scala-2.9.1.final.rb
1 2 3 4 5 6 7 8 9 10
require 'formula'
 
class ScalaDocs < Formula
homepage 'http://www.scala-lang.org/'
url 'http://www.scala-lang.org/downloads/distrib/files/scala-2.9.1.final-devel-docs.tgz'
version '2.9.1'
md5 'acb16cbdf46f682806f60b052707b7b7'
end
 
class Scala < Formula
View gist:998562
1 2 3
/** E.g., UIColorFromRGB(0xE5E5E5) */
 
#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
View androidmanifest_decompressor.groovy
1 2 3 4 5 6 7 8 9 10
// decompressXML -- Parse the 'compressed' binary form of Android XML docs
// such as for AndroidManifest.xml in .apk files
int endDocTag = 0x00100101;
int startTag = 0x00100102;
int endTag = 0x00100103;
 
public void decompressXML(byte[] xml) {
// Compressed XML file/bytes starts with 24x bytes of data,
// 9 32 bit words in little endian order (LSB first):
// 0th word is 03 00 08 00
Something went wrong with that request. Please try again.