Skip to content

Instantly share code, notes, and snippets.

View lynxluna's full-sized avatar
🎯
Focusing

Didiet lynxluna

🎯
Focusing
View GitHub Profile
var idler = uv_idle_t()
uv_idle_init(uv_default_loop(), &idler)
uv_idle_start(&idler, { (_:UnsafeMutablePointer<uv_idle_t>) -> Void in print("Yay")})
print("Idling...")
uv_run(uv_default_loop(), UV_RUN_DEFAULT)
uv_loop_close(uv_default_loop())
import scala.collection.mutable.ListBuffer
import akka.actor.{Actor,ActorRef}
import akka.actor.Actor._
import akka.routing.{ Listeners, Listen }
//Represents a domain event
trait Event
//A builder to create domain entities
trait EntityBuilder[Entity] {
@lynxluna
lynxluna / fb-lite.clj
Created August 17, 2014 05:17
Minimalist Facebook Graph API Client
;; Depends on clj-http and cheshire
(ns com.ykode.social.fb-lite
(:require [clj-http.client :as client]
[cheshire.core :refer [parse-string]]))
(defn- fburl [ext] (str "https://graph.facebook.com/" ext))
(defn- auth-get
[access-token url]
@lynxluna
lynxluna / github.clj
Created August 16, 2014 07:28
Rather Incomplete Github Wrapping Example from kohsuke's Java Github Library
;; Depends on
;; [org.kohsuke.github-api "1.56"]
;; [clj-time "0.8.0"]
;; Samples converting kohsuke's GH* objects to clojure map
;; may inefficient but it works
(ns com.ykode.social.github
(:import [org.kohsuke.github GitHub GHMyself GHUser GHRepository]
[java.net URL])
(:require [clj-time.format :as tf]
@lynxluna
lynxluna / fb.clj
Last active August 29, 2015 14:05
Wrapping Facebook4j to Clojure
;; Wrapping facebook4j in Clojure
;; Please include org.facebook4j/facebook4j-core "2.1.0"]
;; in your project.clj
(ns com.ykode.social.fb ;; change the namespace as you wish
(:import [facebook4j Facebook FacebookException FacebookFactory]
[facebook4j.auth AccessToken]))
(defn- kw->perms
"Converting keyword array such as [:public_profile :email]
(defmacro def-if
"Define a symbol when one condition is met"
([condition sym true-expr]
(if condition `(def sym ~true-expr)))
([condition sym true-expr false-expr]
(if condition `(def sym ~true-expr) `(def sym ~false-expr))))
@lynxluna
lynxluna / test.clj
Last active August 29, 2015 14:05
Mass Update a key
;; Example Nested Map
(def persons [{:name "asep" :address {:street "prikici" :city "tangsel"}}, {
:name "didiet" :address {:street "mijil" :city "sleman"}}])
;; Update Values
(defn update-vals [map vals f]
(reduce #(update-in % [%2] f) map vals))
;; experiment
(def asep (first persons))
(update-in asep [:address] (fn [m] (update-vals m [:street :city] clojure.string/upper-case)))
# command to convert al-quran recitation from gq
ls sudais/*.mp3 | xargs -n 1 -P 10 -I % \
bash -c 'echo Processing %; avconv -v quiet -i % -f wav - | ~/neroAacEnc -ignorelength -cbr 64 -hev2 -if - -of "sudais-aac/$(basename %).aac" > /dev/null 2>&1'
@lynxluna
lynxluna / .bash_profile
Created February 10, 2014 21:44
My most important bash profile to set up my prompt and console coloring.
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
function gitify {
default_prompt="-----------------------------------------\n\e[37;1m[ \w ]\e[0m\] @ \h (\u) \n=> "
git rev-parse --git-dir >/dev/null 2>&1
if [ $? -eq 0 ]; then
light_green="\[\033[1;32m\]"
light_yellow="\[\033[1;33m\]"
@lynxluna
lynxluna / HarfBuzz-Build.md
Last active December 29, 2015 03:39
How to build HarfBuzz on BlackBerry 10 SDK

How to build harfbuzz on BlackBerry 10

  1. Install BlackBerry 10 SDK
  2. Start the environment variable by sourcing /Applications/Momentics.app/bbndk-env.sh
  3. Set the output dir for device and simulator e.g. $HOME/Projects/qnxlib/arm and $HOME/Projects/qnxlib/x86
  4. Execute gtkdocize
  5. Execute autoreconf --force --install --verbose
  6. Use this shell command to build