Skip to content

Instantly share code, notes, and snippets.

View wangshijun's full-sized avatar

wangshijun wangshijun

View GitHub Profile
@wangshijun
wangshijun / markdownhere.css
Created October 22, 2017 23:58 — forked from xiaolai/markdownhere.css
markdown-here-css
.markdown-here-wrapper {
font-size: 16px;
line-height: 1.8em;
letter-spacing: 0.1em;
}
pre, code {
font-size: 14px;
font-family: Roboto, 'Courier New', Consolas, Inconsolata, Courier, monospace;
@wangshijun
wangshijun / fake-referrer.casper.js
Created April 25, 2016 06:27 — forked from papoms/fake-referrer.casper.js
Fake Referrer with CasperJS
var fakeReferrer = "http://porzky.com"
var targetUrl = "http://keyworddomains.com"
var casper = require('casper').create();
casper.start(fakeReferrer, function() {
this.echo(this.getCurrentUrl());
});
casper.then(function(){
@wangshijun
wangshijun / blog-webpack-2.md
Created February 28, 2016 04:09 — forked from xjamundx/blog-webpack-2.md
From Require.js to Webpack - Part 2 (the how)

This is the follow up to a post I wrote recently called From Require.js to Webpack - Party 1 (the why) which was published in my personal blog.

In that post I talked about 3 main reasons for moving from require.js to webpack:

  1. Common JS support
  2. NPM support
  3. a healthy loader/plugin ecosystem.

Here I'll instead talk about some of the technical challenges that we faced during the migration. Despite the clear benefits in developer experience (DX) the setup was fairly difficult and I'd like to cover some of the challanges we faced to make the transition a bit easier.

@wangshijun
wangshijun / INSTALL
Created November 6, 2013 02:40 — forked from mat/INSTALL
TODO:
- edit /opt/statsd/local.js
- correct the graphite host to localhost
- if desired, put 'debug: true' in there
- make the box accessible via the hostname 'graphite'
- update conf/storage-schemas.conf, see example for these retention rules:
6 hours of 10 second data
1 week of 1 minute data
5 years of 10 minute data

This is a general overview (from memory) of the steps I used to install graphite (http://graphite.wikidot.com) on OS X Lion. I think the steps are in order but YMMV. Please fork and fix if you find an error.

Install Python 2.7.2

curl -kL http://xrl.us/pythonbrewinstall | bash
echo '[[ -s $HOME/.pythonbrew/etc/bashrc ]] && source $HOME/.pythonbrew/etc/bashrc' >> ~/.bashrc
[[ -s $HOME/.pythonbrew/etc/bashrc ]] && source $HOME/.pythonbrew/etc/bashrc
pythonbrew install 2.7.2
pythonbrew use 2.7.2
pythonbrew venv create graphite
@wangshijun
wangshijun / rAF.js
Created October 8, 2013 01:49 — forked from paulirish/rAF.js
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<h2>Original CSS</h2>
<style style="display: block; white-space: pre; font-family: monospace">
h2 { margin:0; }
//PhantomJS http://phantomjs.org/ based web crawler Anton Ivanov anton.al.ivanov@gmail.com 2012
(function(host) {
function Crawler() {
this.visitedURLs = {};
};
Crawler.webpage = require('webpage');
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px;
color: #333;
}