Skip to content

Instantly share code, notes, and snippets.

View ikbear's full-sized avatar

Lishi He ikbear

View GitHub Profile
#!/bin/bash
/bin/sh -c "while true; do echo hello world; sleep 1; done"
@ikbear
ikbear / json-unmarshal.go
Created August 24, 2015 02:58
JSON 解析出错
package main
import (
"encoding/json"
"fmt"
)
func main() {
var jsonBlob = []byte(`{
"repo_info": {
@ikbear
ikbear / keyrepeat.shell
Last active August 29, 2015 14:28 — forked from kconragan/keyrepeat.shell
Enable key repeat in Apple Lion for Sublime Text in Vim mode
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
@ikbear
ikbear / docker-registry.go
Created September 7, 2015 01:37
Docker Registry V1 示例
package main
import (
"fmt"
"github.com/CenturyLinkLabs/docker-reg-client/registry"
"net/url"
)
func main() {
@ikbear
ikbear / combination.go
Last active September 12, 2015 17:27
从 n 个数中选择 m 个的组合(n >= m)
package main
import "fmt"
func main() {
fmt.Println(f(5, 3))
}
func f(n, m int) int {
if n <= 0 || m <= 0 {
@ikbear
ikbear / Memory-Management.md
Last active September 12, 2015 15:34 — forked from githubutilities/Memory-Management.md
Memory Management
@ikbear
ikbear / what-forces-layout.md
Created September 22, 2015 16:53 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@ikbear
ikbear / gist:14e8efe091e9ed33ecc0
Created September 22, 2015 17:02 — forked from paulirish/gist:4158604
Learn JavaScript concepts with recent DevTools features

Learn JavaScript concepts with the Chrome DevTools

Authored by Peter Rybin , Chrome DevTools team

In this short guide we'll review some new Chrome DevTools features for "function scope" and "internal properties" by exploring some base JavaScript language concepts.

Closures

Let's start with closures – one of the most famous things in JS. A closure is a function, that uses variables from outside. See an example:

@ikbear
ikbear / loop.sh
Created September 30, 2015 07:37
loop
-------- start loop --------
2015/09/30 15:27:36.745404 [D][SCD][#1443598056][C_0]["qiniu.com/qcos/kernel.v3/sched/sched.go:303"] active!
2015/09/30 15:27:36.746252 [D][SCD][#1443598056][C_0]["qiniu.com/qcos/kernel.v3/sched/pick.go:55"] loadNodesMeta Normal 1 | ReservedNormal 0
2015/09/30 15:27:36.746267 [D][SCD][#1443598056][C_0]["qiniu.com/qcos/kernel.v3/sched/pick.go:56"] loadNodesMeta Offline 0 | ForcedOffline 0
2015/09/30 15:27:36.746274 [D][SCD][#1443598056][C_0]["qiniu.com/qcos/kernel.v3/sched/pick.go:57"] loadNodesMeta Clear 0
2015/09/30 15:27:36.746797 [D][SCD][#1443598056][172.17.0.4]["qiniu.com/qcos/kernel.v3/sched/pick.go:144"] Real <cpu> 0.091 core / 1.000 core = 0.09 <mem> 466.8 MB / 1.956 GB = 0.23 <ls> 16 <bs> 14
2015/09/30 15:27:36.751137 [D][SCD][#1443598056][C_0]["qiniu.com/qcos/kernel.v3/sched/pick.go:380"] check the 0 of 1 pod(s) from app 10000
2015/09/30 15:27:36.751338 [D][SCD][#1443598056][C_0]["qiniu.com/qcos/kernel.v3/sched/pick.go:328"] loadDirtyPods dirty pods(all): 1
2015/09/30 15
@ikbear
ikbear / gist:bcfc3b814f0e70bcc436
Created October 1, 2015 03:03 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan Developer Preview 2

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat