Skip to content

Instantly share code, notes, and snippets.

View Lynn-cc's full-sized avatar
🙃
Is there any intersting ideas ?

Lynn Lynn-cc

🙃
Is there any intersting ideas ?
  • Shenzhen China
View GitHub Profile
@Lynn-cc
Lynn-cc / compareJSON.js
Last active July 12, 2022 08:32
Compare two JSON, output the first difference. 比较两个JSON对象,输出找到的第一个不同点的值及其父级堆栈值
function compare(o1, o2) {
const type1 = Array.isArray(o1) ? 'array' : typeof o1;
const type2 = Array.isArray(o2) ? 'array' : typeof o2;
if (!!o1 !== !!o2) {
console.log('Different boolean value', o1, o2);
return false;
}
if (type1 !== type2) {
console.log('Different type', o1, o2);
return false;
@Lynn-cc
Lynn-cc / getFloat.js
Created January 12, 2015 03:39
使数字保留一定小数位数,返回格式化数字的字符串
var getFloat = function(number, len) {
var lessZero = (number < 0);
var arr;
var result;
function zeroTail(n) {
return (new Array(n + 1)).join('0');
}
@Lynn-cc
Lynn-cc / urlParam.js
Last active August 29, 2015 14:10
对URL的参数进行读写和拼装的javascript函数
/**
* 对URL的参数进行读写和拼装的javascript函数
* @param {string} url
* @return {function} 对应值或者修改后的url
* @example
* url = 'http://example.com?type=0&page=0';
*
* // 返回包含所有参数及值的对象
* urlSearchParam(url)
*
@Lynn-cc
Lynn-cc / china.json
Last active January 20, 2017 05:50
中国省边界geojson,包含了省和湖泊,岛屿。注:新疆西边有一块被划开的未知区域。
[{
"name": "未知",
"path": "M78,-670C75,-673,74,-671,74,-673C75,-675,73,-673,73,-673C71,-673,71,-675,70,-675C69,-674,69,-674,69,-674C69,-674,69,-674,68,-675C67,-676,59,-676,53,-673C53,-672,49,-670,50,-668C55,-662,46,-656,54,-653C56,-652,60,-648,59,-644C88,-643,73,-642,82,-652C84,-654,87,-654,90,-657C88,-658,87,-659,86,-658C83,-656,84,-661,82,-662C78,-662,80,-667,78,-670L78,-670zM54,-634C54,-634,54,-634,54,-634zM56,-635C56,-641,65,-628,68,-637C70,-646,72,-638,74,-643C71,-643,67,-644,59,-644C59,-643,59,-643,58,-642C53,-638,54,-643,53,-635C53,-634,53,-634,54,-634C54,-634,53,-634,54,-634C55,-628,56,-631,56,-635L56,-635zM272,-442C267,-444,266,-438,258,-444C259,-440,254,-435,262,-434C269,-433,262,-427,263,-424C267,-417,260,-422,283,-417C303,-413,296,-425,314,-428C340,-431,330,-442,345,-437C349,-436,351,-438,359,-429C361,-427,363,-427,365,-425C366,-422,367,-424,370,-426C376,-428,370,-428,372,-432C370,-434,370,-437,366,-437C359,-437,359,-442,357,-441C349,-437,354,-445,358,-446C361,-448,358,-449,358,-451C358,-46