Skip to content

Instantly share code, notes, and snippets.

@1yx
1yx / gist:9bd91b60006d5f0d9968
Last active April 4, 2018 04:48
squirrel color scheme with dracula-theme(github.com/zenorocha/dracula-theme).
We couldn’t find that file to show.
@1yx
1yx / leancloud.extension.js
Created November 30, 2015 10:02
扩展leancloud js sdk 中的一些方法
var AV = require('avoscloud-sdk').AV;
AV.Query.prototype.findAll = function () {
var self = this,
data = [];
self._limit = 1000;
self._order = 'createdAt';
return loop(avpromise(0), function (skip) {
self._skip = skip;
@1yx
1yx / readLocation.js
Last active September 26, 2023 01:32
read qq location list file in js, special thanks https://www.v2ex.com/t/32786
var parseString = require('xml2js').parseString;
var fs = require('fs');
var _ = require('underscore');
require.extensions['.xml'] = function (module, filename) {
module.exports = fs.readFileSync(filename, 'utf8');
};
var zh = require("./LocList-zh.xml");
var en = require("./LocList-en.xml");
@1yx
1yx / .eslintrc
Created January 18, 2016 05:57 — forked from ghostwords/.eslintrc
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"arrowFunctions": false, // enable arrow functions
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"classes": false, // enable classes
"defaultParams": false, // enable default function parameters
"destructuring": false, // enable destructuring
@1yx
1yx / InstallStaffOnLinux.md
Last active August 27, 2016 06:58
install staff on Linux

CentOS 6

the_silver_search

$ sudo yum install -y pcre-devel

$ sudo yum install xz-devel

$ cd /usr/local/src
@1yx
1yx / express_error_json.js
Created April 18, 2016 03:48
JSON stringify an Error in Express
// development error handler
// will print stacktrace
if (app.get('env') === 'development') {
app.use(function(err, req, res, next) {
res.status(err.status || 500);
function err2JSON (err) {
var obj = JSON.parse(
JSON.stringify(err, Object.getOwnPropertyNames(err))
@1yx
1yx / table.css
Last active July 22, 2016 03:32
table中隐藏过长的单元格
table {
table-layout: fixed;
}
td {
overflow:hidden; text-overflow: ellipsis;
}
@1yx
1yx / cvim
Last active July 28, 2016 02:28
cvim extension config
set "previousMatchPattern ((?!last)(prev(ious)?|newer|back|«|less|<|‹|上一页| )+)"
set "nextMatchPattern ((?!first)(next|older|more|>|›|»|forward|下一页| )+)"
# Clean, simple, compatible and meaningful.
# Tested on Linux, Unix and Windows under ANSI colors.
# It is recommended to use with a dark background and the font Inconsolata.
# Colors: black, red, green, yellow, *blue, magenta, cyan, and white.
#
# http://ysmood.org/wp/2013/03/my-ys-terminal-theme/
# Mar 2013 ys
# this custom theme add node version
# Sep 2016 dontaire
_.mixin({
'duplicate': (array) => _.filter(array, function (value, index, iteratee) {
return _.includes(iteratee, value, index + 1)
}
});