Skip to content

Instantly share code, notes, and snippets.

View weaming's full-sized avatar
🦀
Rustacean

Garden Yuen weaming

🦀
Rustacean
  • Shenzhen, China
View GitHub Profile
@weaming
weaming / nginx.conf
Created February 26, 2016 15:14
默认配置
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
@weaming
weaming / useso-take-over-google.php
Created February 27, 2016 17:22
wordpress plugin source code
<?php
/*
Plugin Name: Useso take over Google
Plugin URI: http://www.brunoxu.com/useso-take-over-google.html
Description: 用360前端公共库Useso接管Google字体库和Google公共库,无需设置,插件安装激活后即刻生效。
Author: Bruno Xu
Author URI: http://www.brunoxu.com/
Version: 1.6.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@weaming
weaming / JSONView.css
Last active April 5, 2016 03:11
JSONView chrome plugin
body {
white-space: pre;
font-family: monospace;
background-color: #002b36;
color: #ddd;
}
a{
color: green;
}
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
if ($("#toc").length == 0){
console.log('#toc not found.');
return 1;
}
$("h2,h3,h4,h5,h6").each(function(i,item){
var tag = $(item).get(0).localName;
$(item).attr("id","toc"+i);
@weaming
weaming / baidu-as-a-network-utility.css
Last active May 17, 2016 06:55 — forked from tianyuf/baidu-as-a-network-utility.css
BaaN: Baidu as a Network Utility - 百度的实用主义方法论.
@-moz-document domain("baidu.com") {
#u1,
#ftCon,
#form input,
#form span
{display: none;}
#form::after {
font-family: "BlinkMacSystemFont", "Segoe UI", sans-serif;
@weaming
weaming / ua.js
Last active July 11, 2016 07:55 — forked from Takazudo/ua.js
var ua = (function(){
var ua = {};
var navigator = window.navigator;
var platforms = [
{ property: 'platform', regex: /iPhone/i, identity: 'iPhone' },
{ property: 'platform', regex: /iPod/i, identity: 'iPod' },
{ property: 'userAgent', regex: /iPad/i, identity: 'iPad' },
{ property: 'userAgent', regex: /Blackberry/i, identity: 'Blackberry' },
{ property: 'userAgent', regex: /Android/i, identity: 'Android' },
{ property: 'platform', regex: /Mac/i, identity: 'Mac' },
@weaming
weaming / youdao.py
Created August 21, 2016 07:06 — forked from DeanThompson/youdao.py
命令行版本的有道词典
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
命令行版本的有道词典,调用有道翻译的 API 实现
用法一:
% python youdao.py search
原文: search
发音: sɜːtʃ
@weaming
weaming / stylish-rust-lang-reference.css
Created December 24, 2016 17:08
stylish-rust-lang-reference.css
@-moz-document regexp("https://doc.rust-lang.org/reference.*") {
#TOC{
position: fixed;
left: 0;
top: 0;
overflow: scroll;
overflow-x: hidden;
height: 100vh;
max-width: 30vw;
body {font-family: "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; }
#Search div {
background-image:none!important;
border-image-repeat:repeat;
border-image-slice:27 27 27 50;
border-image-source:url(https://v2ex.com/static/img/qbar_light@2x.png);
border-image-width:27px 27px 27px 50px;
width:auto!important;
}
@weaming
weaming / Objectify.py
Created March 10, 2017 10:02
Make a dict or a dict to be object.
class Objectify(object):
def __init__(self, data):
""" data maybe one dict or list """
self.data = data
def __getitem__(self, item):
_data = object.__getattribute__(self, 'data')
return _data[item]
def __getattribute__(self, item):