Skip to content

Instantly share code, notes, and snippets.

Avatar

Ertuğrul Çetin ertugrulcetin

View GitHub Profile
@ertugrulcetin
ertugrulcetin / nested-macro.clj
Created Nov 21, 2020
Clojure nested macro sample
View nested-macro.clj
(defmacro component
([name tag]
`(component ~name ~tag nil))
([name tag docs]
(if docs
`(defmacro ~(with-meta name {:tag tag}) ~docs
[object# k# & options#]
`(u/call! ~object# ~k# ~@options#))
`(defmacro ~(with-meta name {:tag tag})
[object# k# & options#]
@ertugrulcetin
ertugrulcetin / update-xmind.clj
Created Oct 16, 2020
Manipulate Xmind file in Clojure
View update-xmind.clj
(defn update-xmind
"Manipulates Xmind data and saves as a binary format. Usage:
This example updates all \"Report\" titles with \"HEY!\"
(update-xmind \"~/xmind-files/report.xmind\"
\"~/xmind-files/report-new.xmind\"
(fn [data]
(o/transform data
(o/and
(d/query data ?path :title ?title)
@ertugrulcetin
ertugrulcetin / reveal-bindings.clj
Last active Sep 30, 2020
Revealing variables final values based on substitution map by using logic programming in Clojure.
View reveal-bindings.clj
(require '[clojure.core.logic :refer [== run fresh]]
'[clojure.walk :as walk])
(defn function-call->form [form]
(walk/prewalk (fn [node]
(cond
(and (list? node)
(or (-> node first resolve nil?)
(-> node first resolve meta :special-form)
(-> node first resolve meta :macro)))
View middlewares.clj
(defn wrap-some-data
[handler]
(fn [request]
(let [updated-request (assoc request :site-owner "Ertuğrul")]
;; ▼▼▼ returns response ▼▼▼
(handler updated-request))))
;; :resource-ns-path -> src/clj_web_app dizini altındaki namespace'leri tarar ve tüm `resource`'ları bulup döndürür
(def app-routes (get-routes {:resource-ns-path "clj-web-app."
View updated-project.clj
(:require [patika.core :refer [resource get-routes]]
[ring.adapter.jetty :refer [run-jetty]]
;; Middlewares
[ring.middleware.reload :refer [wrap-reload]]
[ring.middleware.cookies :refer [wrap-cookies]]
[ring.middleware.gzip :refer [wrap-gzip]]
[compojure.core :as c]
[compojure.route :as r])
@ertugrulcetin
ertugrulcetin / core.clj
Last active Apr 3, 2020
clj-web-app.core - Clojure ile Örnek Web Uygulaması
View core.clj
(ns clj-web-app.core
(:require [patika.core :refer [resource get-routes]]
[ring.adapter.jetty :refer [run-jetty]]
[compojure.core :as c]
[compojure.route :as r]))
(resource home
:get ["/"]
:content-type :html
:handle-ok (fn [ctx] "<html>
@ertugrulcetin
ertugrulcetin / project.clj
Created Apr 3, 2020
project.clj - Clojure ile Örnek Web Uygulaması
View project.clj
(defproject clj-web-app "0.1.0-SNAPSHOT"
:description "Clojure ile örnek web uygulama"
:url "http://example.com/FIXME"
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
:url "https://www.eclipse.org/legal/epl-2.0/"}
:dependencies [[org.clojure/clojure "1.10.0"]
[ring "1.8.0"]
[patika "0.1.10"]]
:main ^:skip-aot clj-web-app.core
:repl-options {:init-ns clj-web-app.core})
@ertugrulcetin
ertugrulcetin / soyisimler
Created Dec 20, 2019 — forked from emrekgn/soyisimler
Türkçe Soyisim Listesi
View soyisimler
ŞEN
KANDEMİR
ÇEVİK
ERKURAN
TÜTEN
ÖZTÜRK
YÜZBAŞIOĞLU
VURAL
YÜCEL
SÖNMEZ
View turkce_isimler.sql
-- Turkce isimler sozlugu twitter : http://twitter.com/baskindev
CREATE TABLE `isimler` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`isimler` varchar(255) DEFAULT NULL,
`cinsiyet` varchar(255) DEFAULT NULL COMMENT 'erkek : E , kadın : K , uniseks : U',
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
-- ----------------------------
@ertugrulcetin
ertugrulcetin / isimler
Created Dec 4, 2019 — forked from emrekgn/isimler
Türkçe İsim Listesi
View isimler
JALE
ALİ
MAHMUT
MANSUR KÜRŞAD
GAMZE
MİRAÇ
YÜCEL
KUBİLAY
HAYATİ
BEDRİYE MÜGE
You can’t perform that action at this time.