Skip to content

Instantly share code, notes, and snippets.

View fancyboynet's full-sized avatar
😎

Fancy fancyboynet

😎
View GitHub Profile
sudo scutil --set HostName name-you-want
@fancyboynet
fancyboynet / demo.html
Created August 4, 2015 05:01
[css3]立方体
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<meta content="telephone=no" name="format-detection">
<title>cube</title>
<style>
@fancyboynet
fancyboynet / demo.css
Last active October 26, 2015 10:35
移动端用css控制容器高度为多行文本高度
div{
overflow : hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 3; /*3行高*/
-webkit-box-orient: vertical;
}
@fancyboynet
fancyboynet / gist:ae5e1543d26361a756820e93c6fe8dc0
Last active July 26, 2016 06:50 — forked from mfenniak/gist:2978805
An extension of Flask that adds file hashes to static file URLs built by url_for("static"...)
import os.path
import contextlib
import hashlib
from flask import Flask
from flask.helpers import safe_join
# Injects an "h" parameter on the URLs of static files that contains a hash of
# the file. This allows the use of aggressive cache settings on static files,
# while ensuring that content changes are reflected immediately due to the
# changed URLs. Hashes are cached in-memory and only checked for updates when
brew upgrade
brew install redis
brew services start reids
redis-cli ping // will output 'PONG'
yum install redis
systemctl start reids
redis-cli ping
@fancyboynet
fancyboynet / cmd.md
Last active April 10, 2018 07:19
cmd常用命令

删除指定进程

taskkill /pid {pid} /f

获取指定端口进程pid

netstat -ano | findstr :8090
@fancyboynet
fancyboynet / demo.js
Created August 22, 2018 07:12
Automatically bind methods to their class instance
class AutoBindMethod {
constructor () {
Object.getOwnPropertyNames(this.constructor.prototype).forEach(m => {
this[m] = this[m].bind(this)
})
}
}
class Demo extends AutoBindMethod {
constructor () {
@fancyboynet
fancyboynet / post-merge
Created September 18, 2018 06:06 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@fancyboynet
fancyboynet / c.bash
Created November 5, 2018 09:15
Export files listed by git diff between two commits.
git diff --name-only HEAD^ | xargs tar -zcvf update.zip