Skip to content

Instantly share code, notes, and snippets.

View lifeng1992's full-sized avatar
🦜

lifeng1992 lifeng1992

🦜
View GitHub Profile
@theburningmonk
theburningmonk / singleton.dart
Last active September 2, 2022 01:40
Using Dart's factory constructor feature to implement the singleton pattern
class MyClass {
static final MyClass _singleton = new MyClass._internal();
factory MyClass() {
return _singleton;
}
MyClass._internal() {
... // initialization logic here
}
@kavu
kavu / example.go
Created September 28, 2013 10:01
Minimal Golang + Cocoa application using CGO. Build with `CC=clang go build`
package main
/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa
#import <Cocoa/Cocoa.h>
int
StartApp(void) {
[NSAutoreleasePool new];
@hyg
hyg / gist:9c4afcd91fe24316cbf0
Created June 19, 2014 09:36
open browser in golang
func openbrowser(url string) {
var err error
switch runtime.GOOS {
case "linux":
err = exec.Command("xdg-open", url).Start()
case "windows":
err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()
case "darwin":
err = exec.Command("open", url).Start()
@HugoPresents
HugoPresents / set_cookiejar.go
Created December 29, 2014 08:37
golang set cookieJar example
package main
import (
"fmt"
"io/ioutil"
"net/http"
"net/http/cookiejar"
"net/url"
"strings"
)
@robbinhan
robbinhan / new_gist_file.css
Last active January 3, 2020 09:00
flex布局左边固定,右边自适应
.demo{
/*flex布局(作用于容器)*/
display: flex;
/*项目拉伸对齐,也就是所左边的高度为拉伸到和右边等高,默认是拉伸的*/
/*align-items: stretch;*/
}
.demo .left{
/*左边固定宽度,必须设置其最小宽度和最大宽度*/