Skip to content

Instantly share code, notes, and snippets.

💩
working without codes

小鱼 sofish

Block or report user

Report or block sofish

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View no-indent-paragraphs.md

首先要搞清楚“空两格”的意义是什么?段首空格表示段落重新开始,基本小学写作文都这么教的。但“空两格”真的就能清楚标示段落么?这个问题被放大到互联网上,尤其在对比英文段落效果后,中文段落“空两格”的传统开始受到质疑。先来看新浪博客网志页的两格例子:

1. 无空格无换行排版(下图)

无空格无换行排版

2. 有空格无换行排版(下图)

有空格无换行排版

@sofish
sofish / cnpm.log
Created Nov 2, 2015
cnpm.log - 已 npm cache clean && rm -rf ~/.npm ~/.cpm
View cnpm.log
projectPrivate@0.0.1 /srv/www/projectPrivate
├─┬ babel-preset-es2015@6.0.15
│ ├─┬ babel-plugin-transform-es2015-arrow-functions@6.0.14
│ │ └─┬ babel-runtime@5.8.29
│ │ └── UNMET DEPENDENCY core-js@^1.0.0
│ ├─┬ babel-plugin-transform-es2015-block-scoped-functions@6.0.14
│ │ └─┬ babel-runtime@5.8.29
│ │ └── UNMET DEPENDENCY core-js@^1.0.0
│ ├─┬ babel-plugin-transform-es2015-block-scoping@6.0.14
│ │ ├─┬ babel-runtime@5.8.29
@sofish
sofish / invert.js
Created Jun 11, 2015
invert binary tree
View invert.js
function invert(tree) {
if (!tree instanceof Array || tree.length === 1) return tree;
var ret = [];
var inverted = tree.reverse();
for(var cur in inverted) {
if(!inverted.hasOwnProperty(cur)) continue;
ret.push(inverted[cur] instanceof Array ? invert(inverted[cur]) : inverted[cur]);
}
@sofish
sofish / ciaojs-tab.js
Last active Aug 29, 2015
教 Ciao 写 JS:Tab
View ciaojs-tab.js
<html>
<style>
.triggers .active {color:#f30;}
.targets div {display:none;}
.targets .active {display:block;}
</style>
<div class="triggers">
<a href="#tab1" class="active">tab1</a>
@sofish
sofish / lucky.js
Last active Aug 29, 2015
CSS Conf 投资
View lucky.js
var range = function(num) {
return Array(num).fill(1).reduce(function(ret, item, i) {
return ret.concat(i + 1);
}, []);
};
var select = function(num) {
var ID = '___list';
var list = window[ID] || localStorage.getItem(ID);
View drunk-example.js
// 这语法挺正常的
[].indexOf(0); // #1
// 这命名相比上面就醉了
[] instanceof Array; //#2
// 和一面一样的语法,又醉了
typeof []; //#3
// 坑也多
@sofish
sofish / array_unique.js
Last active Jul 11, 2017
Array Unique
View array_unique.js
function unique_keys(array) {
var values = {};
for(var i = 0; i < array.length; i++) {
values[array[i]] = null;
}
return Object.keys(values);
}
View error.js
{"status":"error","error":{"msg":"\u6b64\u997f\u5355\u5df2\u6295\u8bc9","code":23}}
@sofish
sofish / nav.js
Created Oct 29, 2014
nav for uedetail
View nav.js
document.querySelector && window.addEventListener('keyup', function (e) {
var url = e.which === 39 ? document.querySelector('a[rel=prev]').href :
e.which === 37 ? document.querySelector('a[rel=next]').href : '';
if (url) window.location = url;
});
View urlparser.js
var parser = function(url) {
var a = document.createElement('a');
a.href = url;
var search = function(search) {
if(!search) return {};
var ret = {};
search = search.slice(1).split('&');
for(var i = 0, arr; i < search.length; i++) {
You can’t perform that action at this time.