Skip to content

Instantly share code, notes, and snippets.

View iku000888's full-sized avatar
🤣
Having fun coding

Ikuru K iku000888

🤣
Having fun coding
View GitHub Profile
(require '[figwheel-sidecar.system :as sys])
(require '[com.stuartsierra.component :as c])
;;fetch-configはfigwheel.ednファイル,もしくはproject.cljの :cljsbuild と :figwheel の内容からfigwheelの設定値を作って返す
(def config (sys/fetch-config))
;;figwheelのStuart Sierraシステム(必要なコンポーネントの依存関係の定義)をvarに束縛する
;;https://github.com/stuartsierra/component
(def system
(c/system-map
@iku000888
iku000888 / file0.txt
Last active July 9, 2017 22:14
ミニマルなmiesというClojureScript leiningenテンプレート ref: http://qiita.com/iku000888/items/ef360ea75d2b55309ad7
$ lein new mies project-name
@iku000888
iku000888 / file0.cljs
Created July 4, 2017 22:18
Objectに対してaget/asetを使うな、という話 ref: http://qiita.com/iku000888/items/069cf2a84c2d9be5f2da
(.-property an-object)
;; conj to a list
(conj '(1 2 3 4) 5) => (5 1 2 3 4)
;; conj to a vector
(conj [1 2 3 4] 5) => [1 2 3 4 5]
@iku000888
iku000888 / web-driver.clj
Created June 9, 2017 01:48
Using Selenium Web driver from Clojure
(ns anpi-selenium.core
(:import org.openqa.selenium.By
org.openqa.selenium.chrome.ChromeDriver
org.openqa.selenium.htmlunit.HtmlUnitDriver))
;; Dependency: [org.seleniumhq.selenium/selenium-java "3.4.0"]
;;; Original Java Tutorial
;;; https://github.com/SeleniumHQ/selenium/wiki/Getting-Started
@iku000888
iku000888 / callbacks-are-fn.clj
Last active May 18, 2017 15:22
Some fun with callbacks
;; Given a seq of something and an async fn that accepts a callback,
;; how would you process the seq synchronously in order?
(def atm (atom []))
(reset! atm [])
(add-watch atm
:watcha
(fn [k r o n]
(prn k o n)))
@iku000888
iku000888 / Clojure-asciidoc.md
Last active August 25, 2018 04:08
Rendering html from asciidoc with Clojure

Motivation

For giggles :)

Steps

  1. Add this to your dependency:
[org.asciidoctor/asciidoctorj "1.5.5"]
@iku000888
iku000888 / file0.txt
Last active July 27, 2017 03:19
Clojureでリッチなテキストを書く ref: http://qiita.com/iku000888/items/b4d0243e3b5708d22a9b
(load-file "path/to/file.clj")
@iku000888
iku000888 / file0.java
Last active October 26, 2016 00:39
javax.swingのHello WorldをClojureで書く ref: http://qiita.com/iku000888/items/374cc1027bb833748391
package start;
/*
* HelloWorldSwing.java requires no other files.
*/
import javax.swing.*;
public class HelloWorldSwing {
/**
* Create the GUI and show it. For thread safety,
@iku000888
iku000888 / mysql connector example
Last active August 29, 2015 14:22
Functioning mysql.connector example
#Simple demonstration of inserting a utf-8 string into
#mysql table
import mysql.connector
# -*- coding: utf-8 -*-
cnx = mysql.connector.connect(user='root', password='root',
host='127.0.0.1',
database='EN_JAP')
cursor = cnx.cursor()
add_word = ("INSERT INTO word_mp "
"(english_word, japanese_word) "