Skip to content

Instantly share code, notes, and snippets.

View ahonn's full-sized avatar
🐵
Happy Hacking

Yuexun ahonn

🐵
Happy Hacking
View GitHub Profile
clipboard = hs.chooser.new(function (choice)
if choice then
hs.pasteboard.setContents(choice.content)
hs.eventtap.keyStroke({ "cmd" }, "v")
end
end)
local history = {}
function addHistoryFromPasteboard()
local contentTypes = hs.pasteboard.contentTypes()
@ahonn
ahonn / neovim-term.vim
Created March 20, 2019 02:24
neovim term
if has('nvim')
augroup vimrc_term
autocmd!
autocmd WinEnter term://* nohlsearch
autocmd WinEnter term://* startinsert
autocmd TermOpen * tnoremap <buffer> <C-h> <C-\><C-n><C-w>h
autocmd TermOpen * tnoremap <buffer> <C-j> <C-\><C-n><C-w>j
autocmd TermOpen * tnoremap <buffer> <C-k> <C-\><C-n><C-w>k
autocmd TermOpen * tnoremap <buffer> <C-l> <C-\><C-n><C-w>l
let g:ale_sign_error = '✖'
hi! ALEErrorSign guifg=#DF8C8C ctermfg=167
let g:ale_sign_warning = '⚠'
hi! ALEWarningSign guifg=#F2C38F ctermfg=221
for i in range(65,90) + range(97,122)
let c = nr2char(i)
exec "map \e".c." <M-".c.">"
exec "map! \e".c." <M-".c.">"
endfor
@ahonn
ahonn / reagent-ref-functions.clj
Created September 30, 2017 15:57 — forked from pesterhazy/reagent-ref-functions.clj
Using ref functions with reagent
;; React supports "refs" as a way for a component to get a
;; handle to its children. Classically, refs were string-based.
;; Recent versions of React support callback attributes as a
;; more elegant variant of accessing DOM notes or components.
;;
;; This example uses a Form-3 component as per
;; https://github.com/Day8/re-frame/wiki/Creating-Reagent-Components
;;
;; For callback refs, see React's documentation
;; https://facebook.github.io/react/docs/more-about-refs.html
@ahonn
ahonn / clean_weibo.js
Last active September 11, 2017 08:32
Tampermonke script for clean all weibo
// ==UserScript==
// @name clean weibo
// @namespace http://www.ahonn.me/
// @version 1.0
// @description Tampermonke script for clean all weibo
// @author ahonn
// @match http://weibo.com/p/*
// @grant none
// ==/UserScript==