Skip to content

Instantly share code, notes, and snippets.

Avatar
💪

ayato-p ayato-p

💪
  • UZABASE, inc.
  • Tokyo, Japan
View GitHub Profile
View .spacemacs.el
;; -*- mode: emacs-lisp; lexical-binding: t -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Layer configuration:
This function should only modify configuration layer settings."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
;; `+distribution'. For now available distributions are `spacemacs-base'
View liar.clj
(ns liar)
(defn with-liar* [exp]
(map (fn [sym]
(case sym
true 'false
false 'true
sym))
exp))
View multimethod-collatz.clj
(def a (agent 100
:validator #(not= % 1)
:error-handler println))
(defmulti collatz even?)
(defmethod collatz true
[x]
(println x)
(/ x 2))
@ayato-p
ayato-p / core.clj
Last active Dec 12, 2016
`lein new demo` で作って下のコードを貼り付けるだけ。
View core.clj
(ns demo.core
(:require [compojure.core :as c :refer [defroutes GET POST]]
[hiccup.core :as h]
[hiccup.form :as hf]
[ring.adapter.jetty :as server]
[ring.util.response :as res]))
(defn html-response [res]
(res/content-type res "text/html;charset=utf-8"))
View another.clj
(ns example.another)
(defn hello [] (println "Hello"))
View twilog-scraper.core.clj
(ns twilog-scraper.core
(:require [net.cgrand.enlive-html :as html]
[skyscraper :as s])
(:gen-class))
(defn seed [username]
(let [url (str "http://twilog.org/" username "/archives")]
[{:username username
:url url
:processor :archives-page}]))
View my-init.el
;; package
(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/"))
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
(package-initialize)
(require 'cl)
(defvar installing-package-list
'(
anything
View KotlinF_ck.kt
fun Int.isZero() = this == 0
fun Int.lt(other: Int) = this < other
fun Int.lte(other: Int) = this <= other
fun Int.gt(other: Int) = this > other
fun Int.gte(other: Int) = this >= other
class KotlinF_ck {
private var tokens = charArray()
private var jumps = hashMapOf<Int, Int>()
View HQ9Plus.kt
fun <T> Array<T>.component1() = this.get(0)
fun <T> Array<T>.component2() = this.get(1)
class HQ9Plus(private val src: String) {
private var count = 0
fun eval() {
src.forEach {
when(it){
View java_sort.java
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
public class Main {
public static void main(String[] args) {
List<Employee> employees = new ArrayList<>();
employees.add(new Employee("hoge", 3));
employees.add(new Employee("fuga", 1));