This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const tailwindColorsV4Hex = { | |
| slate: { | |
| "50": "#f8fafc", | |
| "100": "#f1f5f9", | |
| "200": "#e2e8f0", | |
| "300": "#cbd5e1", | |
| "400": "#94a3b8", | |
| "500": "#64748b", | |
| "600": "#475569", | |
| "700": "#334155", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| create-qrcode.js | |
| ================ | |
| 基于 qr.js 进行包装, 适用于小程序的通用化的 QRCode JS 生成器 | |
| qr.js 是已经比较成熟的二维码生成相关的 JS 移植,然而其内部的渲染机制需要浏览器相关特性的支持,使得在小程序端无法直接使用。 | |
| 小程序中也无法使用 SVG 直接渲染,而如果使用 DOM 结构渲染或者 Canvas 渲染的话,需要的开发和接入成本也会上升。 | |
| 因此这里使用的方案是: SVG 字符串生成后,转化为 dataURL 字符串,可以直接作为小程序中的 image 标签的 src 属性直接使用。 | |
| 因为是 SVG 矢量图, 因此可以渲染为任意尺寸。 | |
| ### INSTALLATION 安装: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| path access: object util get/set with path access | |
| get(obj, path) => value of obj at path: | |
| expect(get({ a: 0 }, 'b[1].c')).toBe(null); | |
| expect(get({ b: [0, { c: 'CCC' }] }, 'b[1].c')).toBe('CCC'); | |
| set(obj, path, value) => new object updates object value at path | |
| expect(set({a: 0}, 'b.c', 1)).toMatchObject({ a:0, b: {c: 1} }); | |
| expect(set({a: 0}, 'b.c', 2, (v) => v * 10).b.c).toBe(20); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Playground - noun: a place where people can play | |
| import UIKit | |
| class ViewController: UIViewController ,UITableViewDelegate, UITableViewDataSource | |
| { | |
| var tableView: UITableView! | |
| var items: NSMutableArray! | |
| override func viewDidLoad() { | |
| super.viewDidLoad() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var gulp = require("gulp"); | |
| gulp.task("rjs",function(cb){ | |
| var rjs = require("requirejs"); | |
| var config = { | |
| baseUrl:"../scripts", | |
| name:"main", | |
| // optimize: "none", | |
| mainConfigFile:"../scripts/require-config.js", | |
| out:"../res/bundle.js", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Adding context for req/res cycle for Express.js. | |
| # With context it would be possible to write more terse code: | |
| # | |
| # app.use -> | |
| # @user = {name: 'Anonymous'} | |
| # @next() | |
| # | |
| # app.get '/', -> | |
| # @res.end "Hello, #{@user.name}" | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .desktop(@rules){ | |
| @media (min-width: 769px) { @rules(); } | |
| } | |
| .pad(@rules) { | |
| @media (max-width: 769px) { @rules(); } | |
| } | |
| .phone(@rules){ | |
| @media (max-width: 420px) { @rules(); } | |
| } | |
| .clearfix(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| _.random.str() : "Quick" | |
| _.random.str(3) : "Jumps Jumps Fox" | |
| _.random.list() : [43, 65, 52, 65, 49] | |
| _.random.list(3) : [43, 65, 49] | |
| */ | |
| (function(){ | |
| var methods = { | |
| num:function(num1,num2){ | |
| num1=num1||100; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| getJSON = (url,callback)-> | |
| require("http").get url,(res)-> | |
| res.on "data",(data)-> | |
| data = JSON.parse data.toString() | |
| callback data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mongoBetweenDate = (date1,date2=false)-> | |
| parseDateStr = (date)-> | |
| dateStr = date.replace(/-/g,"/") | |
| d = new Date dateStr | |
| d = false if d is "Invalid Date" | |
| d | |
| date1 = parseDateStr date1 | |
| where = {} | |
| if date1 |
NewerOlder