Skip to content

Instantly share code, notes, and snippets.

View wangshijun's full-sized avatar

wangshijun wangshijun

View GitHub Profile
#!/bin/bash
sudo apt-get remove phantomjs
sudo unlink /usr/local/bin/phantomjs
sudo unlink /usr/local/share/phantomjs
sudo unlink /usr/bin/phantomjs
cd /usr/local/share
//Practically all this code comes from https://github.com/alangrafu/radar-chart-d3
//I only made some additions and aesthetic adjustments to make the chart look better
//(of course, that is only my point of view)
//Such as a better placement of the titles at each line end,
//adding numbers that reflect what each circular level stands for
//Not placing the last level and slight differences in color
//
//For a bit of extra information check the blog about it:
//http://nbremer.blogspot.nl/2013/09/making-d3-radar-chart-look-bit-better.html
'use strict';
/*
IMPORTANT: requires Underscore.js (http://underscorejs.org)
Usage: ng-repeat="item in items | fuzzyFilter: searchText"
*/
var app = angular.module('app', []);
var gulp = require('gulp'),
sass = require('gulp-sass'),
browserify = require('gulp-browserify'),
concat = require('gulp-concat'),
embedlr = require('gulp-embedlr'),
refresh = require('gulp-livereload'),
lrserver = require('tiny-lr')(),
express = require('express'),
livereload = require('connect-livereload')
livereloadport = 35729,
// Requires jQuery from http://jquery.com/
// and jQuerySparklines from http://omnipotent.net/jquery.sparkline
// AngularJS directives for jquery sparkline
angular.module('sparkline', []);
angular.module('sparkline')
.directive('jqSparkline', [function () {
'use strict';
return {
@wangshijun
wangshijun / CSS
Created August 27, 2012 07:34
Border-Radius
-webkit-border-radius: 3px 3px 0 0;
-khtml-border-radius: 3px 3px 0 0;
-moz-border-radius: 3px 3px 0 0;
-ms-border-radius: 3px 3px 0 0;
-o-border-radius: 3px 3px 0 0;
border-radius: 3px 3px 0 0;
@wangshijun
wangshijun / hideaddrbar.js
Created August 27, 2012 07:33 — forked from scottjehl/hideaddrbar.js
Normalized hide address bar for iOS & Android
/*
* Normalized hide address bar for iOS & Android
* (c) Scott Jehl, scottjehl.com
* MIT License
*/
(function( win ){
var doc = win.document;
// If there's a hash, or addEventListener is undefined, stop here
if( !location.hash && win.addEventListener ){
@wangshijun
wangshijun / gist:3521924
Created August 30, 2012 03:02
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@wangshijun
wangshijun / ip.php
Created September 11, 2012 06:21 — forked from MilkZoft/ip.php
php: get user ip address
<?php
function get_client_ip() {
if(isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
if(isset($_SERVER["HTTP_CLIENT_IP"])) {
return $_SERVER["HTTP_CLIENT_IP"];
} else {
return $_SERVER["REMOTE_ADDR"];
}
return $_SERVER["HTTP_X_FORWARDED_FOR"];
@wangshijun
wangshijun / uri.js
Created October 13, 2012 11:50 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"