Skip to content

Instantly share code, notes, and snippets.

View kuanyui's full-sized avatar
❄️
なんでそんなに慣れてんだよ!

クエン酸 kuanyui

❄️
なんでそんなに慣れてんだよ!
View GitHub Profile
@kuanyui
kuanyui / 雅量.org
Last active September 10, 2016 17:14

朋友裝了新系統,變色龍帶綠色的皮膚與圓睜睜的大眼睛,當她拿給我們看時,一位對Linux十分感與趣的同學說:

「啊,桌布的Geeko好可愛!」

「我沒用過openSUSE耶,好用嗎?」我說。

「根本糞distro。不用Arch的人都智能不足啦。」一位見到人就要傳教、外號叫「引戰客」的同學緊接著說。

我們不禁啞然失笑,同樣的一個distro,每個人卻有不同的感覺。那位朋友連忙把筆電蓋上,她覺得openSUSE就是openSUSE,不是變色龍,也不是智力測驗,更不是宗教。

大大安安

自我介紹

ono hiroko

Github

kuanyui

Lisp

各種神話的語言

Emacs Lisp

廣泛使用的 Lisp 方言

風和日麗的一天

(defun run-length (results)
(if (null results)
results
(let ((tmp (run 1 (car results) (cdr results))))
(cons (car tmp) (run-length (cdr tmp))))))
(defun run (times elem remains)
(cond ((equal elem (car remains)) (run (1+ times) elem (cdr remains)))
((= times 1) (cons elem remains))
((> times 1) (cons (list times elem) remains))))
;; (:= a 1) a = 1
;; (:= a (list 1 2 3)) a = (1 2 3)
;; (:= (a b c) (1 2 3)) a = 1, b = 2, c = 3
(defmacro := (places values)
`(cond ((and (listp (quote ,places))
(listp ,values))
(if (eq (length (quote ,places)) (length ,values))
(map 'list (lambda (sym val) (set sym val)) (quote ,places) ,values)
(error "The length of two args are not equal")))
@kuanyui
kuanyui / hexo-help.el
Created February 26, 2016 15:55
如何開個temp buffer在目前window下方顯示你要顯示的鬼東西
(setq hexo-help-buffer "*hexo-help*")
(defun hexo-command-open-fixed-help-window ()
(interactive)
(select-window (split-window-below -6))
(if (not (get-buffer hexo-help-buffer))
(temp-buffer-window-setup hexo-help-buffer))
(switch-to-buffer hexo-help-buffer)
(let ((inhibit-read-only t))
(insert (hexo-get-help-string)))
@kuanyui
kuanyui / gist:4ea9a95618175b067c0cc43b479a58f7
Created August 2, 2016 05:56
replace-tab-in-jade-file-to-spaces
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import os, subprocess, re
import fileinput
def replaceTabInFile(filePath):
print("Processing file {} ...".format(filePath))
with fileinput.FileInput(filePath, inplace=True) as f:
for line in f:
Canvas {
id: canvasTest
property int ratio: Screen.devicePixelRatio
width: 100 //* ratio
height: 100 //* ratio
//scale: 1/ratio
Path {
id: myPath1
startX: 0; startY: 50
@kuanyui
kuanyui / mousePositionInVideoOutput.qml
Last active August 9, 2024 08:28
QtAV中的VideoOutput2在不同螢幕解析度下的滑鼠座標 (QtMultimedia內建的VideoOutput也許也適用,但我他媽的一個影片也沒播成功過所以無法測試)
Item {
id: videoArea
anchors.top: parent.top
width: parent.width
height: parent.height - panelRectangle.height
VideoOutput2 {
id: videoOutput
anchors.fill: parent
source: player
}
@kuanyui
kuanyui / README.md
Last active October 11, 2016 07:16
我還是搞不懂 QML 的 Component 在幹嘛

這個範例中使用 Loader { sourceComponent: block } 來載入名為 block 的 component,會導致 ColumnLayout 無法在 blockvisible 狀態改變時自動調整大小。

然而,如果把 block 獨立出成單一檔案 Block.qml ,然後直接在 ColumnLayout 中使用 Block {} 來載入 component,就沒有上述問題,Layout能夠自動根據 Blockvisible 來自動調整大小。

在QML中,我常常寫類似這樣的東西:

Item {
    id: settings
    property alias snapshot: snapshot
    Item {
        id: snapshot
        property string saveDirectory: "~/hello/world/"
  }
}