This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ql:quickload 'babel) | |
(defbinstruct class-file | |
(magic 4) ;; values are bytes when types aren't specified | |
(minor-version 2) | |
(major-version 2) | |
(constant-pool (:struct constant-pool)) | |
(access-flags 2) | |
(this-class 2) | |
(super-class 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
{- | |
I wrote this to get a bettern understanding of Haskell way of doing | |
side effects, which turns out, is not much fun :) | |
-} | |
import Todo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(in-package :cl-user) | |
(defpackage :m-utils | |
(:use :cl) | |
(:export :from-list :print-ht)) | |
(in-package m-utils) | |
(defmacro from-list (list &rest params) | |
"A hash-table generator inspired by Haskell's fromList." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Graphics.UI.SDL as SDL | |
import Graphics.UI.SDL.Events | |
quitHandler :: IO () | |
quitHandler = do | |
e <- waitEvent | |
putStrLn $ show e | |
case e of | |
Quit -> return () | |
otherwise -> quitHandler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DotUtils where | |
{- | |
- Some helper functions to create graphviz representation of Trie structures. | |
-} | |
import Trie | |
import qualified Data.Map as Map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ "keys": ["ctrl+u"], "command": "move", "args": {"by": "pages", "forward": false} }, | |
{ "keys": ["ctrl+d"], "command": "move", "args": {"by": "pages", "forward": true} }, | |
{ "keys": ["ctrl+h"], "command": "focus_group", "args": { "group": 0 } }, | |
{ "keys": ["ctrl+l"], "command": "focus_group", "args": { "group": 1 } }, | |
{ "keys": ["ctrl+w"], "command": "delete_word", "args": { "forward": false } }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def requires_authentication(f): | |
def df(request): | |
json_response = {"result": "fail"} | |
if request.user.is_authenticated and request.user.is_active: | |
json_response.update(f(request)) | |
return HttpResponse(json.dumps(json_response), mimetype="application/json") | |
return df |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns lastfm | |
(:require [clojure.string :as str] | |
[clojure.java.io :as io] | |
[clj-http.client :as client] | |
[clojure.zip :as zip] | |
[clojure.xml :as xml]) | |
(:use [clojure.data.zip.xml])) | |
(defn- parse-str [s] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Bencode decoder. Converts bencoded strings/streams to CL data | |
;;; structures. | |
;;; Usage: | |
;;; (bencode:decode stream-or-string) | |
;;; Bencode dictionaries will be converted to alists and lists will be | |
;;; converted to CL lists. | |
;;; TODO: error handling. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Reader: | |
def __init__(self, form): | |
self.form = form | |
self.index = 0 | |
def seek_char(self): | |
if self.index >= len(self.form): | |
return None | |
return self.form[self.index] |