Skip to content

Instantly share code, notes, and snippets.

View kaid's full-sized avatar
🚀
Vibe coding

Kaid Wong kaid

🚀
Vibe coding
  • Beijing, PRC
  • 16:04 (UTC +08:00)
View GitHub Profile
@kaid
kaid / moveCursorTo.js
Created April 23, 2015 09:27
move cursor to beginning of element
function moveCursorTo(el) {
let selection = getSelection()
, range = document.createRange();
range.setStart(el.childNodes[0], 0);
range.collapse(true);
selection.removeAllRanges();
selection.addRange(range);
}
#
# Example configuration file.
#
# See unbound.conf(5) man page, version 1.4.22.
#
# this is a comment.
#Use this to include other text into the file.
#include: "otherfile.conf"
@kaid
kaid / .tmux.conf
Last active August 29, 2015 14:00
tmux conf
set -g prefix C-q
unbind C-b
bind-key q send-prefix
bind-key z last-window
bind-key r source-file ~/.tmux.conf
set -g status-left-length 32
set -g status-right-length 150
# -------------
@kaid
kaid / zhihu_hot.js
Last active June 6, 2019 04:08
知乎热门问题抓取脚本
//==== Displayer ====
var Displayer = function() {
this.$el = jQuery("body").prepend(
"<div class=\"hotqs-list\">" +
"<div class=\"head\">" +
"<div>关注</div>" +
"<div>回答</div>" +
"</div>" +
"<div class=\"loading\">开始抓取问题</div>" +
@kaid
kaid / migrate
Last active August 29, 2015 13:56
python helper script for generating activeandroid migrations
#!/usr/bin/env python
import xml.etree.ElementTree as ET
import os
import time
def main():
generate_migration()
# manipulate manifest.xml
@kaid
kaid / translator.rb
Created January 8, 2014 09:17
text transformation util, can be used to build simple text markup parsers.
module Translator
class NoPatternError < Exception
end
class BufferEmptyError < Exception
end
class IllegalTokenError < Exception
end
@kaid
kaid / json_serializable.coffee
Created September 12, 2013 13:45
JSONSerializable
guid = ->
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace /[xy]/g, (c)->
r = Math.random()*16|0
v = if c == 'x' then r else (r&0x3|0x8)
v.toString(16)
is_dom = (v)->
typeof jQuery != "undefined" &&
v instanceof jQuery ||
v instanceof Node
@kaid
kaid / boot.conf
Last active November 24, 2016 23:42
funtoo_zfs_install
boot {
generate grub
default "Funtoo ZFS"
timeout 4
}
"Funtoo Linux" {
kernel bzImage[-v]
}
@kaid
kaid / capture_rect.js
Last active October 11, 2016 03:39
phantomjs批量截取网页某一区域脚本
var base = 'http://dev.kaid.me/c';
var ids = [1, 2, 3, 41, 42, 43, 51, 52, 53];
ids.forEach(function(id) {
var page = require('webpage').create(),
url = base + id,
output = 'c' + id + '.png';
page.clipRect = {top:122, left:65, width:360, height:600};
@kaid
kaid / player_choices.md
Created August 17, 2012 03:49
html5媒体播放器的选择

视频播放器

html5视频播放器:

+------------+---------------------------------+
| videojs    | http://videojs.com              |
+------------+---------------------------------+
| projekktor | http://www.projekktor.com       |
+------------+---------------------------------+