Skip to content

Instantly share code, notes, and snippets.

@Clarence-pan
Clarence-pan / 0_reuse_code.js
Last active August 29, 2015 14:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Clarence-pan
Clarence-pan / my.css
Last active August 29, 2015 14:26 — forked from anonymous/my.css
CSS Gradient Animation
background: linear-gradient(207deg, #10ec6f, #172de1);
background-size: 400% 400%;
-webkit-animation: test 6s ease infinite;
-moz-animation: test 6s ease infinite;
-o-animation: test 6s ease infinite;
animation: test 6s ease infinite;
@-webkit-keyframes test {
    0%{background-position:58% 0%}
    50%{background-position:43% 100%}
    100%{background-position:58% 0%}
@Clarence-pan
Clarence-pan / v2ex_auto_login.py
Last active August 29, 2015 14:27 — forked from tdoly/v2ex_auto_login.py
v2ex 自动登录,领取金币脚本
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import sys
import logging
import datetime
import requests
import BeautifulSoup
from requests.adapters import HTTPAdapter

解决 Git 在 windows 下中文乱码的问题

原因

中文乱码的根源在于 windows 基于一些历史原因无法全面支持 utf-8 编码格式,并且也无法通过有效手段令其全面支持。

解决方案

  1. 安装
@Clarence-pan
Clarence-pan / simple-httpd-helloworld.php
Created December 1, 2016 07:05
一个简单的模拟Apache(httpd)的程序,通过PHP写的哟~ 性能还是很好的,比node.js有时候都快。
<?php
// 运行:
// php simple-httpd-helloworld.php [port]
// 默认端口号是80,可以通过命令行第一个参数指定端口号。
// 注意:需要支持pcntl和socket(不能在windows下跑 -- 可以在windows下的bash on ubuntu on windows中跑)
declare(ticks = 1);
@Clarence-pan
Clarence-pan / zhihu-fix.css
Last active August 29, 2017 08:09
Fix the style of zhihu in my opinion
.AppHeader-inner,
.Footer,
.Card.AppBanner,
.Card[data-za-module=RelatedLives]{
display: none !important;
}
.Card{
position: relative;
z-index: 1;
}
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>CSS3 Marquee Test</title>
<style>
.marquee{
@Clarence-pan
Clarence-pan / gulp-css-base64-async.js
Created March 31, 2017 10:49
Make gulp-css-base64 run async... Optimized str.replace, fs.readFileSync, url.split...
// Make gulp-css-base64 run async...
// Inspired by gulp-css-base64
// Optimized str.replace, fs.readFileSync, url.split...
// fixed bug: global regex should not be used concurrently.
// NodeJS library
var fs = require('fs');
var path = require('path');
var mime = require('mime');
var util = require('util');
var Stream = require('stream').Stream;
@Clarence-pan
Clarence-pan / __fix_document_root.php
Created May 19, 2017 06:07
修复项目的document_root
<?php
// 修复项目的document_root
// 备份server以备后查
$GLOBALS['_SERVER_OLD'] = $_SERVER;
// 修改DOCUMENT_ROOT等环境变量
$_SERVER['DOCUMENT_ROOT'] = __DIR__;
$_SERVER['CONTEXT_DOCUMENT_ROOT'] = $_SERVER['DOCUMENT_ROOT'];
@Clarence-pan
Clarence-pan / install-php-httpd.sh
Created May 24, 2017 10:59
Script To Install PHP7 And Apache2
#!/bin/sh -xe
yum install -y wget gcc make automake autoconf
export SRC_DIR=/data/server/src
export PHP_VERSION=7.1.5
export HTTPD_VERSION=2.4.25
export HTTPD_PREFIX=/data/server/httpd-$HTTPD_VERSION
export PHP_PREFIX=/data/server/php-$PHP_VERSION