Skip to content

Instantly share code, notes, and snippets.

View littledian's full-sized avatar
🤒
Out sick

littledian

🤒
Out sick
View GitHub Profile
$element-separator: '__';
$modifier-separator: '--';
$state-prefix: 'is-';
@function selectorToString($selector) {
$selector: inspect($selector);
$selector: str-slice($selector, 2, -2);
@return $selector;
}
function inherit (p) {
if (p == null) throw new TypeError()
if (Object.create) return Object.create(p)
const t = typeof p
if (t !== 'object' && t !== 'function') throw new TypeError()
function f () {}
f.prototype = p
class Set {
static _next = 0
constructor (...args) {
this.values = {}
this.n = 0
this.add.apply(this, args)
}
const getUserInfo = (function() {
let userInfo = null
let promise = null
return function(cb) {
if (!userInfo && !promise) {
promise = new Promise(resolve => {
setTimeout(() => {
userInfo = {username: 'littledian'}
resolve()
cb && cb(userInfo)
function generateRandomPassword() {
const randomChar = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
const randomNum = '0123456789'
const randomSymbol = '!@#$%^&*()'
const getRandomChar = () => randomChar[Math.floor(Math.random() * randomChar.length)]
const getRandomNum = () => randomNum[Math.floor(Math.random() * randomNum.length)]
const getRandomSymbol = () => randomSymbol[Math.floor(Math.random() * randomSymbol.length)]
const passwordLength = 8