Skip to content

Instantly share code, notes, and snippets.

View simonmysun's full-sized avatar

孙茂胤 (Sun, Maoyin) simonmysun

View GitHub Profile
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active November 2, 2024 12:56
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@adammiller
adammiller / douglasPeucker.js
Created February 14, 2011 16:54
Javascript implementation of the Douglas Peucker path simplification algorithm
var simplifyPath = function( points, tolerance ) {
// helper classes
var Vector = function( x, y ) {
this.x = x;
this.y = y;
};
var Line = function( p1, p2 ) {
this.p1 = p1;
@pizn
pizn / category_plugin.rb
Created February 24, 2012 08:47
category plugin for jekyll blog
module Jekyll
class CategoryIndex < Page
def initialize(site, base, dir, category)
@site = site
@base = base
@dir = dir
@name = 'index.html'
self.process(@name)
@dwayne
dwayne / 00-install-on-64-bit-ubuntu-14.04.md
Last active January 12, 2024 17:48
Installing node and npm on Ubuntu 12.04 LTS and 64-bit Ubuntu 14.04 LTS.
  1. Navigate to http://nodejs.org/download/ and on the Linux Binaries (.tar.gz) row click to download the 64-bit version of the current latest release.

  2. Say you've downloaded node-v0.10.7-linux-x64.tar.gz into the Downloads directory. Then, open the terminal and type the following:

$ cd ~/Downloads
$ mkdir -p ~/local/node
$ tar xzf node-v0.10.7-linux-x64.tar.gz -C ~/local/node --strip-components=1
$ echo '# Node Enviroment Setup' >> ~/.bashrc
$ echo 'export PATH=$HOME/local/node/bin:$PATH' &gt;&gt; ~/.bashrc
@lastland
lastland / BeyesianAvg.py
Created August 11, 2012 07:14
尝试用这篇post: http://www.matrix67.com/blog/archives/5044 中的方法实现的一个自动中文抽词算法的Python程序
# -*- coding=utf-8 -*-
import collections
# Usage:
# 我的做法是把WordsDetector.py里的结果输出到文件,
# 然后把文件名放到下面的names列表中,运行本程序。
names = ['name0',
'name1',
'name2',
@cloudaice
cloudaice / world_location_map.json
Last active April 14, 2016 10:00
update file at utctime 2016-04-14 10:00:39.468129
{
"Taipei,Taiwan": "TW",
"Vancouver": "CA",
"SF,/,BOS,/,NYC,/,LA": "BO",
"Omaha,NE": "NE",
"China,Canton,Guangzhou": "CN",
"Arkansas": "US",
"Beijing,China": "CN",
"Waco,TX": "US",
"Ancona,Italy": "IT",
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active November 10, 2024 03:45
A badass list of frontend development resources I collected over time.
@summivox
summivox / renren-markdown.user.js
Last active August 28, 2016 15:58
renren-markdown v1.0.0 preview (2013-11-06)
// Copyright (c) 2013, smilekzs. (MIT Licensed)
// ==UserScript==
// @name renren-markdown
// @namespace http://github.com/smilekzs
// @version 1.0.0
// @description Powerful markdown-based editor for blog.renren.com
// @grant GM_xmlhttpRequest
// @match *://blog.renren.com/blog/*Blog*
// @match *://blog.renren.com/blog/*edit*
// @match *://blog.renren.com/*Entry*
@whitlockjc
whitlockjc / html-ejs.el
Last active December 21, 2015 01:19
Use mmm-mode to enable EJS Template highlighting in html-mode
;; ...
;; Use mmm-mode to enable EJS (http://embeddedjs.com) Template highlighting in html-mode
;; Turn on mmm-mode
(require 'mmm-mode)
(setq mmm-global-mode 'maybe)
;; mmm-mode class for EJS Templates
(mmm-add-classes
@ljsabc
ljsabc / BTCChina-UserStyle
Created October 12, 2013 08:52
This is a simple user stylesheet for BTCChina real-time stats : http://i.btc123.com/index_btcchina.php
@import url(http://fonts.googleapis.com/css?family=Open+Sans:300);
@-webkit-keyframes animatedBackground {
from {
background-position: 0 0;
}
to {
background-position: 100% 0;
}
}