Skip to content

Instantly share code, notes, and snippets.

Avatar
🙅‍♂️
それだめ

LY Cheng yhsiang

🙅‍♂️
それだめ
View GitHub Profile
@yhsiang
yhsiang / Posts.re
Created Dec 6, 2017
ReasonReact Posts Component
View Posts.re
type post = {
userId: int,
id: int,
title: string,
body: string
};
type posts = list(post);
type state = {
@yhsiang
yhsiang / Calendar.elm
Last active Jun 28, 2016
Calendar by elm-lang
View Calendar.elm
module Calendar exposing (..)
import String
import Html exposing (div, span, node, text, button)
import Html.Attributes exposing (style)
import Html.Events exposing (onClick)
import Array
import Date exposing (Date)
import Date.Extra.Core exposing (daysInMonth, monthToInt, lastOfPrevMonthDate, firstOfNextMonthDate, toFirstOfMonth)
@yhsiang
yhsiang / Main.elm
Created Jun 21, 2016
Simple Selector in Elm
View Main.elm
import Html exposing (node, div, span, text, input)
import Html.Attributes exposing (style, placeholder, value)
import Html.Events exposing (onClick)
import Html.App exposing (beginnerProgram)
{-| Representation of an selectable item. -}
type alias Item =
{ label : String
, value : String
}
@yhsiang
yhsiang / gist:ef79aa356d33c97d3a4a20d8706e6e19
Created May 23, 2016
influence mapping projects from @mckinneyjames
View gist:ef79aa356d33c97d3a4a20d8706e6e19
http://influencemapping.org/
http://littlesis.org/
http://www.poderopedia.org/
https://quienmanda.es/
https://www.quienesquien.wiki/
http://ahalo.hu/
http://openoil.net/
http://www.openinterests.eu/
http://siyazana.co.za/
http://www.openduka.org/
View gist:45dbdca70dceb0e65a88
closeBooker: function () {
var self = this;
clearTimeout(self.timer); //make sure visibility timer is cleared
//slide booker closed
self.booker.animate({
'left': '-100%'
}, self.transitionSpeed, function () {
//hide booker and active section in booker
self.booker.hide()
.find('div.request-container.active')
View parser.clj
(ns pic-parser.core
(:require [clj-http.client :as client]
[net.cgrand.enlive-html :as html]
[clojure.data.json :as json]))
(def target-url "http://public.318.io/search?viewmode=grid")
(def img-base "http://public.318.io/sites/318_public/files/styles/large/public/digicoll/public/010/")
(defn get-body
"return body content"
@yhsiang
yhsiang / core.clj
Created Nov 10, 2015
Axe Lv3 Clojure Implementation http://axe.g0v.tw/level/3
View core.clj
(ns axe.core
(:require [clj-http.client :as client]
[net.cgrand.enlive-html :as html]
[clojure.data.json :as json]))
(def axe-lv3-url "http://axe-level-1.herokuapp.com/lv3/")
(def cs (clj-http.cookies/cookie-store))
(defn parse-cookie
@yhsiang
yhsiang / core.clj
Created Nov 9, 2015
axe lv2 Clojure Implementation for http://axe.g0v.tw/level/2
View core.clj
(ns axe.core
(:require [clj-http.client :as client]
[net.cgrand.enlive-html :as html]
[clojure.data.json :as json]))
(def axe-lv2-url "http://axe-level-1.herokuapp.com/lv2/")
(def town-keys [:town :village :name])
(defn parse-table
View core.clj
(ns axe.core
(:require [clj-http.client :as client]
[net.cgrand.enlive-html :as html]
[clojure.data.json :as json]))
(def axe-url "http://axe-level-1.herokuapp.com/")
(def grades-keys [:國語 :數學 :自然 :社會 :健康教育])
(defn parse-table
View gist:c4a0ad3ed1851d8d29f5
input 5
output:
*
***
*****
*******
*********