Coder Social home page Coder Social logo

snippets's Introduction

Snippets

很多语言、很多配置、很多语法,太多太多东西,不能单靠大脑来记忆。本应用 收集了一些平时常用以及网上寻觅的代码片段,并且在页面中提供了搜索功能,可以快速找到我们平时记下的代码,这里保存的部分片段还是十分有价值的。

本应用对应的网址为: http://snippets.barretlee.com

snippet

贡献代码

如果你希望帮助丰富代码片段库,可以操作如下流程:

git clone https://github.com/{YOUR_GITHUB_NAME}/snippets.git
cd snippets
git checkout -b gh-pages
cd snippets
# 选择你想提交的文件类型,比如 html
cd html
touch {YOUR_CONTRIBUTE_FILE_NAME}.snippet

其中,{YOUR_CONTRIBUTE_FILE_NAME}.snippet 的格式为:

---
title: {NAME}
---

{CONTENT}

可以使用 markdown 语法。

  • 提交代码
git add --all
git commit -m "add file html/{YOUR_CONTRIBUTE_FILE_NAME}.snippet"
git push origin gh-pages
  • 然后在你的 PR 页面提交一个 PR 到 barretlee/snippets 的仓库

关于

小胡子哥

小胡子哥的联系方式

LISCENSE

MIT LISCENSE.

自由分享使用,注意保留署名。

snippets's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

snippets's Issues

fds

贡献 snippet 格式如下,我会帮助整理并发布


category:

  • javascript
  • [] article
  • [] css
  • [] htaccess
  • [] html
  • [] less
  • [] mac
  • [] nginx
  • [] nodejs
  • [] sass
    author: 大名/邮箱/@github用户名/微博地址
    title: 简洁介绍代码片段用途,如「遍历脚本」
    title_en: 英文名,可略
    description: 详细介绍,可略

/**
- @author: {{post.author}} 
- @description: {{post.title || post.description}} 
  */

// code here..

代码片段地址:<http://snippets.barretlee.com/#!/snippets/{{post.category}}/{{post.title_en || post.title}}/>

test

Type

  • [] css

Title

test

Content

system.out.println("hello snipper")

JAVA

Type

  • [] article
  • [] css
  • [] htaccess
  • [] html
  • javascript
  • [] less
  • [] mac
  • [] nginx
  • [] nodejs
  • [] sass

Title

  • Your Snippet Name
  • Your Snippet Description

Content

// code here.

是否考虑增加用户功能

比如,可以注册用户,每个人用户名下有自己的 snippets,然后全局也是可以搜到的(或者可以设置公开或不公开)。

test

Type

  • [] article
  • [] css
  • [] htaccess
  • [] html
  • javascript
  • [] less
  • [] mac
  • [] nginx
  • [] nodejs
  • [] sass

Title

  • Your Snippet Name
  • Your Snippet Description

Content

// code here.

根据日期字符串组成的数组得到一个序列化日期对象

Type

  • javascript

Title

  • 根据日期字符串组成的数组得到一个日期对象。

  • @param { array }
    ['20150606', '20160606', '20150506', '20150507', '20150508', '20150808', '20140606', '20180606', '20120606']

    @return { object }
    { year : { month: [date, date] }, year: .... }

Content

    function getSerializeDateObj (dateAry) {
      const dateObj = {};
      dateAry.forEach(item => {
         const year = item.slice(0,4), month = item.slice(4);
         if (dateObj[year]) {
           dateObj[year].push(month);
         } else {
           dateObj[year] =  [month];
         }
      });
      for (const key in dateObj) {
        const year = dateObj[key], obj = {};
        year.forEach(item => {
           const month = item.slice(0, 2), day = item.slice(2);
           if (obj[month]) {
             obj[month].push(day);
           } else {
             obj[month] = [day];
           }
        });
        dateObj[key] = obj;
      }
      return dateObj;
    }

移动终端浏览器版本信息

贡献 snippet 格式如下,我会帮助整理并发布


category:

  • javascript
  • [] article
  • [] css
  • [] htaccess
  • [] html
  • [] less
  • [] mac
  • [] nginx
  • [] nodejs
  • [] sass
    author: 大名/邮箱/@github用户名/微博地址
    title: 简洁介绍代码片段用途,如「遍历脚本」
    title_en: 英文名,可略
    description: 详细介绍,可略

/**
 * @author:https://github.com/mlyknown 
 * @description: mlyknown 
 */

// code here..

                ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
                android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或uc浏览器
                iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器
                iPad: u.indexOf('iPad') > -1, //是否iPad

代码片段地址:<http://snippets.barretlee.com/#!/snippets/{{post.category}}/{{post.title_en || post.title}}/>

aa

Type

  • [] article
  • [] css
  • [] htaccess
  • [] html
  • javascript
  • [] less
  • [] mac
  • [] nginx
  • [] nodejs
  • [] sass

Title

  • Your Snippet Name
  • Your Snippet Description

Content

// code here.

验证码

Type

  • [] article
  • [] css
  • [] htaccess
  • [] html
  • javascript
  • [] less
  • [] mac
  • [] nginx
  • [] nodejs
  • [] sass

Title

  • Your Snippet Name
  • Your Snippet Description

Content

// code here.

思美的codecollect

Type

  • [] article
  • [] c#
  • [] asp.net
  • [] html
  • javascript
  • [] java
  • [] mac
  • [] nginx
  • [] nodejs
  • [] sass

Title

  • Your Snippet Name
  • Your Snippet Description

Content

// code here.

测试下怎么使用

Type

需要怎么处理呢

  • [] article
  • [] css
  • [] htaccess
  • [] html
  • javascript
  • [] less
  • [] mac
  • [] nginx
  • [] nodejs
  • [] sass

Title

  • Your Snippet Name
  • Your Snippet Description

Content

// code here.

nixiaobai

Type

  • [] article
  • [] css
  • [] htaccess
  • [] html
  • javascript
  • [] less
  • [] mac
  • [] nginx
  • [] nodejs
  • [] sass

Title

  • Your Snippet Name
  • Your Snippet Description

Content

// code here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.