Skip to content

Instantly share code, notes, and snippets.

View yhsiang's full-sized avatar
🙅‍♂️
それだめ

LY Cheng yhsiang

🙅‍♂️
それだめ
View GitHub Profile
package main
import (
"bytes"
"crypto/tls"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
@yhsiang
yhsiang / Posts.re
Created December 6, 2017 05:39
ReasonReact Posts Component
type post = {
userId: int,
id: int,
title: string,
body: string
};
type posts = list(post);
type state = {
@yhsiang
yhsiang / Calendar.elm
Last active June 28, 2016 02:29
Calendar by elm-lang
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 June 21, 2016 08:44
Simple Selector in 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 02:26
influence mapping projects from @mckinneyjames
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/
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')
@yhsiang
yhsiang / parser.clj
Created November 12, 2015 13:19
parse all image from http://public.318.io/
(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 November 10, 2015 04:16
Axe Lv3 Clojure Implementation http://axe.g0v.tw/level/3
(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 November 9, 2015 16:32
axe lv2 Clojure Implementation for http://axe.g0v.tw/level/2
(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
(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