Skip to content
View gitconfig
[alias]
co = checkout
ci = commit
st = status
br = branch
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
type = cat-file -t
l = log --oneline --decorate
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
View mac-deals-scrapper.clj
(ns mac-deals-checker.core
(:require [reaver :refer [parse extract-from text]]))
(def deal-url "http://www.apple.com/sg/shop/browse/home/specialdeals/mac")
(defn latest-deals-info
[]
(-> deal-url slurp parse (extract-from ".product" [:spec :price] "td.specs" text "span.current_price span span" text)))
View gist:c4f793e953f7d8623acb
var safeImageURI = function(s) { return encodeURI(s).replace(/\-/g, "%2D").replace(/\_/g, "%5F").replace(/\./g, "%2E").replace(/\!/g, "%21").replace(/\~/g, "%7E").replace(/\*/g, "%2A").replace(/\'/g, "%27").replace(/\(/g, "%28").replace(/\)/g, "%29"); }
View gist:6208758
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
#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
(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
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
;;; 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
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
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)
Something went wrong with that request. Please try again.