Skip to content

Instantly share code, notes, and snippets.

View mkhoeini's full-sized avatar

Mohammad Sadegh Khoeini mkhoeini

View GitHub Profile
@mfikes
mfikes / psr.md
Last active December 3, 2015 09:22
How to use Planck Socket REPL

Socket REPL support for Planck has now landed in master. You can homebrew a copy of master via

brew remove planck
brew install --HEAD planck

When you launch Planck, pass the -n argument specifying a port or IP:port combination

@bendlas
bendlas / select.clj
Last active December 13, 2015 16:48
This is a draft of the current production state of my clojurescript enlive port. From the other end, I'm factoring enlive, so that its engine can work on any tree. That should enable a lot of shared code between a clj and a cljs version.
;; The macros
;; most macros here alias names from select.cljs
;; they will get used in regular calls
(ns lib.select
(:require
[clojure.string :as str]))
;; selector syntax
(defn intersection [preds]
@bendlas
bendlas / predicate.clj
Created February 13, 2013 07:00
This file is not part of the cljs port as of yet, but a tidbit from my enlive cleanup effort It shows how to implement CSS3 operations in terms of zippers, in that form it should be trivial to adapt to the DOM it's basically the predicates library from enlive, but lifted to a zipper level, so that it can work generically
(ns workbench.enlive.predicate
(:require
[clojure.zip :as z]
[workbench.enlive.engine
:refer [compile-step]]
[workbench.enlive.select
:refer [zip-select]]))
;; ## Builtin predicates
;;
(ns parser)
(defn read-char [rdr]
(let [ch (.read rdr)]
(if-not (== -1 ch) (char ch))))
(def expr-tags
{:if #(str "if tag args: " (clojure.string/join ", " %1))})
(defn expr-tag [{:keys [tag-name args] :as tag} rdr]
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
@pjlsergeant
pjlsergeant / bubble.pl
Created November 27, 2012 09:23
BubbleCharts of DB Tables
#!perl
# Display a bubble chart of DB tables, with rows and relationships to other tables
# Either run directly: perl bubble.pl
# Or with Plack: plackup bubble.pl
use strict; use warnings;
# cpanm Dancer Template DBIx::Class::Schema::Loader Data::Google::Visualization::DataTable
use Dancer;
class Callback {
constructor(f) {
// this.run = f
this.run = callback => {
try {
f(callback)
} catch (ex) {
callback(ex, null)
}
@WillNess
WillNess / ChurchList.hs
Last active June 7, 2017 20:44
Church-encoded Lists are efficient?
http://stackoverflow.com/questions/15589556/why-are-difference-lists-not-an-instance-of-foldable
/15593349?noredirect=1#comment22277557_15593349
a = singleton 1 singleton x = ChurchList $ \k z -> k x z
b = snoc a 2 snoc xs x = ChurchList $ \k z -> runList xs k (k x z)
c = snoc b 3
d = append c c append u v = ChurchList $ \k z -> runList u k (runList v k z)
runList a k z = k 1 z a := ChurchList $ \k z -> k 1 z
runList b k z = runList a k (k 2 z) = k 1 (k 2 z) b := ChurchList $ \k z -> runList a k (k 2 z)
@taesiri
taesiri / fftube.py
Last active August 24, 2017 12:20
Extract frames from youtube videos
import argparse
import youtube_dl
import ffmpy
samples_per_video = 10
game_dic = {}
def save_frame(url, time, game_name):
if game_name not in game_dic.keys():
game_dic[game_name] = 0
@mszajna
mszajna / look_ma_no_frameworks.clj
Last active March 15, 2018 07:15
Clojure reloaded workflow without libraries
(extend-type Object
Closable
(.close [o] o))
(defn closable-jetty [server]
(reify Closable (close [_] (.stop server))))
(defn start []
(let [system (promise)]
(future