Skip to content

Instantly share code, notes, and snippets.

View vincenting's full-sized avatar
:octocat:

Vincent Ding vincenting

:octocat:
  • EPAM System
  • Suzhou, China
  • 02:11 (UTC +08:00)
  • X @hiwensen
View GitHub Profile
@vincenting
vincenting / cyprush.js
Created December 16, 2019 07:27
Run cypress tests concurrently.
/* eslint-disable import/no-extraneous-dependencies */
const path = require('path');
const fs = require('fs');
const glob = require('glob');
const concurrently = require('concurrently');
const { promisify } = require('util');
const rand = `${Math.random()}`.substring(0, 10);
const CYPRESS_TMP_FILE = `./cypress.${rand}.json`;
const HEX_BYTES_RELATIONS = [
["0", "0000"],
["1", "0001"],
["2", "0010"],
["3", "0011"],
["4", "0100"],
["5", "0101"],
["6", "0110"],
["7", "0111"],
["8", "1000"],
module.exports = {
//...
externals: {
'popper.js': {
commonjs: 'popper.js',
amd: 'popper.js',
root: 'Popper',
}
}
};
npx vue-cli-service build --target lib --name index ./src/index.js --dest ./lib
npx babel ./src/style -d ./lib/style -D
├── CHANGELOG.md
├── __tests__
│   └── button.spec.js
├── lib
│   ├── index.common.js
│   ├── index.common.js.map
│   ├── index.umd.js
│   ├── index.umd.js.map
│   ├── index.umd.min.js
│   ├── index.umd.min.js.map
@vincenting
vincenting / output.umd.js
Last active October 19, 2018 21:50
webpack output with externals
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("popper.js"));
else if(typeof define === 'function' && define.amd)
define(["popper.js"], factory);
else if(typeof exports === 'object')
exports["index"] = factory(require("popper.js"));
else
root["index"] = factory(root["Popper"]);
})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE_dbbc__) {})
@vincenting
vincenting / index.js
Last active October 18, 2018 09:59
Using javascript to control the dependency relationship for the style
import './dialog.scss'
import '@interal-components/button/lib/style'
const { makeExecutableSchema } = require('graphql-tools');
const typeDefs = [`
type Query {
hello: String
}
schema {
query: Query
}`];
@vincenting
vincenting / AzDG_crypt.py
Last active May 30, 2016 04:50
A better AzDG crypt for python.
import hashlib
import random
import string
import base64
def randomword(length):
return ''.join(random.choice(string.lowercase) for i in range(length))
@vincenting
vincenting / salesman.rb
Created November 15, 2015 02:31
A designing enganced model for creating restful webservice.
class Salesman < Sequel::Model(:crm_resources_salesmen)
include Restfy::Model
allow_method :update, :get, :query, :create
exclude_fields_for [:get, :query], :tenantId
exclude_fields_for_update :tenantId, :groupId
include_fields_for_create :id
one_to_many :logs
one_to_many :tasks