Skip to content

Instantly share code, notes, and snippets.

View z2015's full-sized avatar
🎯
Focusing

William Zhou z2015

🎯
Focusing
View GitHub Profile
@z2015
z2015 / webpack.config.js
Last active May 2, 2016 02:05
处理Webpack提取出来的 css 里面的路径
//http://react-china.org/t/webpack-css/2299
//https://github.com/webpack/extract-text-webpack-plugin
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const definePlugin = new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
@z2015
z2015 / lyrce.py
Created May 2, 2016 02:08
两个pyspider抓取代码
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Created on 2015-12-17 07:58:28
# Project: lyrce
from pyspider.libs.base_handler import *
class Handler(BaseHandler):
crawl_config = {
@z2015
z2015 / flv.html
Created May 2, 2016 02:10
播放flv格式的html代码
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="640" height="480" id="VideoPlayer" align="middle">
<param name="allowScriptAccess" value="*" />
<param name="allowFullScreen" value="true" />
<param name="movie" value="http://www.platipus.nl/flvplayer/download/1.0/FLVPlayer.swf?video=http://www.platipus.nl/flvplayer/download/pl-600.flv&autoplay=true" />
<param name"quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="http://www.platipus.nl/flvplayer/download/1.0/FLVPlayer.swf?video=http://www.platipus.nl/flvplayer/download/pl-600.flv&autoplay=true" quality="high" bgcolor="#000000" width="640" height="480" name="VideoPlayer" align="middle" allowScriptAccess="*" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
@z2015
z2015 / textindent.css
Created May 2, 2016 02:11
CSS隐藏文字的新方法(可以取代text-indent首行缩进)
.hide-text {
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
}
@z2015
z2015 / wp-config.php
Created May 2, 2016 02:13
解决WordPress数据库导入出错MYSQL import fails with Unknown collation: ‘utf8mb4_unicode_ci’
/** 创建数据表时默认的文字编码 */
define('DB_CHARSET', 'utf8mb4');
/** 创建数据表时默认的文字编码 */
define('DB_CHARSET', 'utf8');
@z2015
z2015 / app.js
Created May 2, 2016 02:15
jQuery获取ul元素内最后一行的所有元素
$('ul').each(function () {
var $lis = $('li', this);
var count = $lis.length;
if (count < 4) {
$lis.addClass('last-row');
} else {
var numberInLastRow = count % 3 || 3;
$lis.eq(-1 * numberInLastRow - 1).nextAll().addClass('last-row');
@z2015
z2015 / functions.php
Created May 2, 2016 02:16
WordPress搜索结果排除页面类型
//exlude page from search results
function SearchFilter($query) {
if ($query->is_search) {
$query->set('post_type', 'post');
}
return $query;
}
add_filter('pre_get_posts','SearchFilter');
@z2015
z2015 / app.js
Created May 2, 2016 02:18
一幅图让你了解JavaScript
//https://github.com/coodict/javascript-in-one-pic
@z2015
z2015 / ubuntu.sh
Created May 2, 2016 02:20
ubuntu建立nodejs与node的关联
ln -s /usr/bin/nodejs /usr/bin/node
@z2015
z2015 / vertical-align.css
Created May 2, 2016 02:21
两种实现css垂直居中vertical-align的方法
/*#1*/
div {
display: table-cell;
vertical-align: middle;
}
/*#2*/
<h3>With an added pseudo element it's possible</h3>
<div class="block2"><div class="inner">Inline-Block</div></div>