Skip to content

Instantly share code, notes, and snippets.

View ertugrulcetin's full-sized avatar

Ertuğrul Çetin ertugrulcetin

View GitHub Profile
@yogthos
yogthos / RichHickeyInterview.md
Created April 25, 2017 00:38
An in-depth look at the new language with Rich Hickey, Creator of Clojure

from http://www.linuxjournal.com/article/10708

An in-depth look at the new language with Rich Hickey, Creator of Clojure

DE: What did you do before you started the Clojure project?

RH: I'm a consultant, so I work on various things. I think the big thing I've done recently is I worked on the national exit poll.

DE: What other languages did you use before inventing your own?

(def i (js/Image.))
(def p (js/Promise. (fn [resolve]
(set! (.-onload i) #(resolve i))
(set! (.-src i) "url.jpg"))))
(.then p (.-log js/console))

State of Clojure Survey 2018 - Open comment question

This is a selection of the most articulated critique found in the open comments section Q25 at the bottom of the survey. Recurring themes are:

  1. Elitism, ivory tower, "not smart enough to get it" attitude of frequent speaker or early adopters.
  2. Poor basic documentation, error messages, beginner friendly resources.
  3. Fear of contribution (with reasons like a. community-built tools open to attack and replacement by core team b. hostile contribution environment c. closed development process)
  • The community has to grow to create more opportunities. Many organizations don't want to even consider using it because they fear not being able to find Clojure developers. Unless you have a mentor or are extremely motivated, Clojure scares away most imperative developers. My suggestions is to team up with a university and get a Clojure course on Coursera or a similar platform. This is the only way I got in
@jasich
jasich / scroll.cljs
Created December 11, 2016 02:28
ClojureScript scroll element into view
;; Based on https://github.com/GabrielDelepine/smooth-scroll/blob/main/smooth-scroll.js
(ns example.scroll)
(def speed 500)
(def moving-frequency 15)
(defn cur-doc-top []
(+ (.. js/document -body -scrollTop) (.. js/document -documentElement -scrollTop)))
(defn element-top [elem top]
@alandipert
alandipert / kahn.clj
Last active June 24, 2023 17:59
Kahn's topological sort in Clojure
;; Copyright (c) Alan Dipert. All rights reserved.
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;; By using this software in any fashion, you are agreeing to be bound by
;; the terms of this license.
;; You must not remove this notice, or any other, from this software.
(ns alandipert.kahn
(:require [clojure.set :refer [difference union intersection]]))
@sunng87
sunng87 / reflection.clj
Created November 20, 2015 10:04
clojure: access private field/method via reflection
(defn invoke-private-method [obj fn-name-string & args]
(let [m (first (filter (fn [x] (.. x getName (equals fn-name-string)))
(.. obj getClass getDeclaredMethods)))]
(. m (setAccessible true))
(. m (invoke obj args))))
(defn private-field [obj fn-name-string]
(let [m (.. obj getClass (getDeclaredField fn-name-string))]
(. m (setAccessible true))
(. m (get obj))))
@hiredman
hiredman / boot.cljs
Created March 15, 2013 04:43
clojurescript drag and drop
(defn handle-file-select [evt]
(.stopPropagation evt)
(.preventDefault evt)
(let [files (.-files (.-dataTransfer evt))]
(dotimes [i (.-length files)]
(let [rdr (js/FileReader.)
the-file (aget files i)]
(set! (.-onload rdr)
(fn [e]
(let [file-content (.-result (.-target e))
@cvan
cvan / webgl-detect-gpu.js
Last active January 19, 2024 02:54
use JavaScript to detect GPU used from within your browser
var canvas = document.createElement('canvas');
var gl;
var debugInfo;
var vendor;
var renderer;
try {
gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
} catch (e) {
}
@blacktaxi
blacktaxi / ruby-fmt.clj
Created January 25, 2012 14:42
Ruby-like string interpolation in Clojure
; Ruby has an awesome feature -- string interpolation. Read about it on the internet.
; On the other hand, Clojure only has cumbersome Java string formatting, which can not be
; used without pain after you've tried Ruby.
; So here's this simple macro that basically allows you to do most things you could do
; with Ruby string interpolation in Clojure.
(ns eis.stuff
(:require [clojure.string]))
@ibraheem4
ibraheem4 / postgres-brew.md
Last active May 1, 2024 09:43 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update