Skip to content

Instantly share code, notes, and snippets.

@adison
adison / outlineview.m
Last active January 14, 2022 06:14
make source list style nsoutlineview programmatically
NSScrollView* container = [[NSScrollView alloc] initWithFrame:CGRectMake(0, 0, 200, 100)];
container.hasVerticalScroller = YES;
container.hasHorizontalScroller = YES;
container.wantsLayer = YES;
container.identifier = [@(LOGVIEW_OFFSET + i) stringValue];
NSClipView* clipview = [[NSClipView alloc] init];
clipview.autoresizesSubviews = YES;
clipview.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
@adison
adison / disable-lock.html
Created April 13, 2014 15:40
disable webpage lock
<!--
disable web page locks,
for chrome, get extesion: https://chrome.google.com/webstore/detail/personalized-web/plcnnpdmhobdfbponjpedobekiogmbco
and add code below
-->
<style type="text/css">
* {
-moz-user-select: text !important;
-webkit-user-select:auto !important;
@adison
adison / remove_comments.py
Last active August 4, 2017 17:34
remove comments in sublime text
import sublime_plugin
import sublime
# code from http://stackoverflow.com/questions/26286879/can-we-make-use-of-syntax-highlighting-feature-to-remove-all-comments-from-a-sou
# how to use
# save as remove_commands in sublime text package/user folder,
# open foloder from [Preferences] > [Browser Packages], and you will find [User] folder
# save this file in [User] foler.
#
# after file saved, open command panel in sublime text, aka ctrl + `
@adison
adison / gist:7543152
Last active December 28, 2015 18:29
XML for keyremap4macbook, use for japanese keypad layout 1. chane kana key to option_R (把右邊的kana按鈕當做 option) 2. Use the right option and right shift to select the next input source(用左邊的英數按鈕切換輸入法)
<?xml version="1.0"?>
<root>
<item>
<name>用左邊的英數按鈕切換輸入法 - Switch Input Source by left en</name>
<appendix>Use the right option and right shift to select the next input source(用左邊的英數按鈕切換輸入法)</appendix>
<identifier>private.switch_next_input_source_by_jiseiuu</identifier>
<autogen>--KeyToKey-- KeyCode::JIS_EISUU, KeyCode::SPACE, ModifierFlag::COMMAND_L</autogen>
</item>
<item>
<name>把右邊的kana按鈕當做 option - change kana to option_r</name>
@adison
adison / gist:6190247
Created August 9, 2013 00:43
generate json, json like data by Java
/*
this code tis purposed to make data for AngularJS from data kind of
province district
data-A1 data-B1
data-A1 data-B2
data-A1 data-B3
to
[province: "data-A1", districts: [
{distict: "data-B1"},
{distict: "data-B2"},
@adison
adison / gist:6119198
Created July 31, 2013 04:08
檢查瀏覽器版本
//檢查版本
function checkBrowserVersion(){
var isShowBrowserNotice = false;
var N= navigator.appName, ua= navigator.userAgent, tem;
var M= ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
if(M && (tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1];
M= M? [M[1], M[2]]: [N, navigator.appVersion, '-?'];
var version = M[1].substring(0, M[1].indexOf("."));
//chrome < 15, firefox <2, ie <8 出现提示
if((M[0]== "Chrome" && 15 > parseInt(version)) || (M[0]== "Firefox" && 2 > parseInt(version)) || (M[0]== "MSIE" && 8 > parseInt(version)))
@adison
adison / Midnight.dvtcolortheme
Created December 8, 2015 02:53
Xcode midnight theme with Source-Code-Pro font
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DVTConsoleDebuggerInputTextColor</key>
<string>1 1 1 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>Menlo-Bold - 11.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
<string>1 1 1 1</string>
@adison
adison / Front-end-Developer-Interview-Questions-TC.md
Created November 19, 2015 15:46 — forked from hanksudo/Front-end-Developer-Interview-Questions-TC.md
Front-end-Developer-Interview-Questions - 前端工程師面試問題集(繁體中文版)

前端工程師面試問題集

@版本 2.0.0

譯注:此翻譯版,主要給不能流利的讀英文的人看,相關專有名詞還是保留原文。翻譯不好地方請協助pull request.

此repository包含了一些前端開發的面試問題,來審查一個有潛力的面試者。這並不是建議你對同一個面試者問上所有的問 (那會花費好幾小時)。從列表中挑幾個題目,應該就夠幫助你審查面試者是否擁有你需要的技能。

Rebecca MurpheyBaseline For Front-End Developers 也是一篇很棒且值得讀的文章在你開始面試之前。

@adison
adison / CasksInstall.sh
Created November 5, 2015 16:19 — forked from visioncan/CasksInstall.sh
CasksInstall
#!/bin/bash
# install xcode command tool
xcode-select --install
# check
xcode-select -p
# install brew
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@adison
adison / googleSearchChangePageWithArrow.js
Created December 1, 2012 00:57
google search change page with arrow kets(left/right)
/*
在 Google 頁面使用方向鍵切換上一頁、下一頁
Change result page with Arrow keys(left/right) on google search pages.
請搭配以下環境參數和 Personalized Web 參數使用
env: chrome with extension "Personalized Web" ( https://chrome.google.com/webstore/detail/personalized-web/plcnnpdmhobdfbponjpedobekiogmbco )
setting of Personalized Web:
Match URLs: ^https://www.google.com/search.*
Add JavaScript: add the following JS
*/