Skip to content

Instantly share code, notes, and snippets.

View yaodong's full-sized avatar

Yaodong Zhao yaodong

View GitHub Profile
.label-dot {
display: inline-block;
width: 14px;
height: 14px;
border-radius: 7px;
border: 1px solid transparent;
&._none {
background: transparent;
border-color: #bbb;
# WELCOME TO SQUID 3.1.20
# ----------------------------
#
# This is the documentation for the Squid configuration file.
# This documentation can also be found online at:
# http://www.squid-cache.org/Doc/config/
#
# You may wish to look at the Squid home page and wiki for the
# FAQ and other documentation:
# http://www.squid-cache.org/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yaodong
yaodong / pinboard_schema.sql
Created January 6, 2016 05:17
pinboard.in schema
-- MySQL dump 10.13
--
-- Pinboard database schema
-- Feel free to use this however you like. Send questions to [email protected].
-- For best results, use the Percona version of MySQL! http://www.percona.com/software/percona-server/
CREATE TABLE `bookmarks` (
`id` int(11) NOT NULL,
`url` mediumtext, -- verbatim URL (may differ from actual URL referenced by url_id)
@yaodong
yaodong / qingcloud.css
Created January 1, 2016 17:12
qingcloud.css
article,aside,details,figcaption,figure,footer,header,hgroup,nav,section,summary
{
display: block;
}
audio,canvas,video
{
display: inline-block;
}
audio:not([controls])
{
@yaodong
yaodong / github_api_move_file.rb
Last active November 24, 2015 16:56
Rename file use Github API
master_ref = client.ref(repo, 'heads/master')
last_commit = client.commit(repo, master_ref[:object][:sha])
last_tree = client.tree(repo, last_commit[:sha], recursive: true)
changed_tree = last_tree[:tree].map(&:to_hash).reject { |blob| blob[:type] == 'tree' }
changed_tree.each { |blob| blob[:path] = 'History.markdown-2' if blob[:path] == 'History.markdown' }
changed_tree.each { |blob| blob.delete(:url) && blob.delete(:size) }
new_tree = client.create_tree(repo, changed_tree)
new_commit = client.create_commit(repo, 'move file test', new_tree[:sha], last_commit[:sha])
client.update_ref(repo, 'heads/master', new_commit.sha)
@yaodong
yaodong / nginx.conf
Created November 13, 2015 18:30 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@yaodong
yaodong / gist:f133d542ab50166f0148
Created August 24, 2015 14:50
dnscrypt-proxy daemonize
sudo dnscrypt-proxy --resolver-name=opendns-port53 --local-address=127.0.0.1:5353 --logfile=/var/log/dnscrypt.log --pidfile=/var/run/dnscrypt.pid --daemonize
@yaodong
yaodong / gist:7eb60267dd8a742498a9
Created August 13, 2015 14:49
active record with ssl encryption
require 'openssl'
require 'digest/sha1'
require 'base64'
require 'json'
class Setting < ActiveRecord::Base
belongs_to :user, inverse_of: :settings
serialize :content, JSON
class Person
attr_accessor :name
def set_name
@name = 'joe'
end
def dump_by_varibale
puts @name
end