Skip to content

Instantly share code, notes, and snippets.

View sofish's full-sized avatar
🚀
still hiring creatives

小鱼 sofish

🚀
still hiring creatives
View GitHub Profile
#!/bin/bash
echo 'start...'
git lfs install
git clone https://huggingface.co/coreml/coreml-lofi-V2
git clone https://huggingface.co/coreml/coreml-realisticVision-v20
git clone https://huggingface.co/coreml/coreml-floralPatterns-v10
git clone https://huggingface.co/coreml/coreml-vanGoghDiffusion_v1
git clone https://huggingface.co/coreml/coreml-Project-AIO
@sofish
sofish / random.js
Created January 27, 2021 02:55
random.js
const os = require('os');
module.exports = function random() {
return +(process.hrtime()[1] * os.freemem() % 1000 / 1000).toFixed(2);
}
@sofish
sofish / tupleStringToTable.lua
Created August 24, 2020 06:15
read str and parse it as table
function s2t(str)
local t = {}
local l = string.len(str)
local key = ''
local val = ''
local oe = 0
for i = 1, l do
local s = string.sub(str, i, i)
if s ~= ' ' then
@sofish
sofish / 0.3.js
Created April 29, 2020 09:11
0.1 + 0.2 = 0.3
function big(n, m) {
var a1 = f(n), a2 = f(m);
var overflow = d(a1[1], a2[1]);
arr = [a1[0] + a2[0] + overflow[0], overflow[1]];
return +arr.join('.');
}
function f(n) {
var tmp = ('' + n).split('.');
if(tmp.length === 1) tmp[1] = '0';

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

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

无空格无换行排版

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

有空格无换行排版

@sofish
sofish / cnpm.log
Created November 2, 2015 03:50
cnpm.log - 已 npm cache clean && rm -rf ~/.npm ~/.cpm
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 June 11, 2015 05:43
invert binary tree
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 August 29, 2015 14:13
教 Ciao 写 JS:Tab
<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 August 29, 2015 14:12
CSS Conf 投资
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);
// 这语法挺正常的
[].indexOf(0); // #1
// 这命名相比上面就醉了
[] instanceof Array; //#2
// 和一面一样的语法,又醉了
typeof []; //#3
// 坑也多