Skip to content

Instantly share code, notes, and snippets.

🙉
stack overflowed

Gerald gera2ld

🙉
stack overflowed
Block or report user

Report or block gera2ld

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View setting-input.vue
<template>
<input v-if="ready" type="text" :class="{'has-error': error}" v-model="value">
</template>
<script>
import { debounce } from '#/common';
import options from '#/common/options';
import hookSetting from '#/common/hook-setting';
export default {
@gera2ld
gera2ld / string-util.js
Last active Oct 24, 2019
JavaScript utilities
View string-util.js
const { Readable } = require('stream');
export function string2stream(string) {
const reader = new Readable();
reader.push(string);
reader.push(null);
return reader;
}
@gera2ld
gera2ld / storage.js
Created Sep 30, 2019
Storage wrapper
View storage.js
export function getStorage(provider) {
return initialize();
function initialize() {
if (!provider) provider = window.localStorage;
return {
get,
set,
bind,
};
@gera2ld
gera2ld / git-update.py
Created May 18, 2019
Update all git repositories in a directory
View git-update.py
import os
import sys
import time
from queue import Queue, Empty
from threading import Thread
from git import Repo
root = sys.argv[1]
concurrency = 10
@gera2ld
gera2ld / test-violentmonkey.user.js
Last active Nov 8, 2019
Test Violentmonkey functions
View test-violentmonkey.user.js
// ==UserScript==
// @name test script
// @namespace Violentmonkey Scripts
// @icon https://cn.gravatar.com/avatar/a0ad718d86d21262ccd6ff271ece08a3?s=80
// @resource baidu https://www.baidu.com/img/baidu_jgylogo3.gif
// @resource text data:text/plain,hello,world
// @run-at document-start
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_deleteValue
@gera2ld
gera2ld / loadmore.js
Created Feb 17, 2017
`v-loadmore` directive for Vue.js 2
View loadmore.js
import Vue from 'vue';
import throttle from 'lodash.throttle';
Vue.directive('loadmore', {
bind(el, binding, vnode) {
let value = binding.value || {};
let callback;
if (typeof value === 'function') {
callback = value;
value = {};
@gera2ld
gera2ld / polyfill.js
Last active Feb 7, 2017
Simple polyfills for JavaScript
View polyfill.js
function polyfill(obj, key, value) {
if (!obj[key]) Object.defineProperty(obj, key, {
value,
configurable: true,
writable: true,
});
}
// Polyfill Object.assign
polyfill(Object, 'assign', (obj, ...args) => {
View svgo.yml
plugins:
- removeTitle: true
- removeStyleElement: true
- removeDimensions: true
- removeAttrs:
attrs:
- class
- fill
- fill-rule
- stroke
@gera2ld
gera2ld / gulp-rev-manifest.js
Last active Dec 1, 2016
Fix gulp-rev's bug of overwriting rev-manifest.json
View gulp-rev-manifest.js
const fs = require('fs');
const path = require('path');
const manifest = function () {
function collect() {
return through.obj(function (file, enc, cb) {
if (!file.path || !file.revOrigPath) {
return cb();
}
const revisionedFile = file.relative;
View es5.eslintrc.yml
rules:
block-scoped-var:
- 2
no-console:
- 2
- allow:
- warn
- error
no-unused-vars:
- 2
You can’t perform that action at this time.