Skip to content

Instantly share code, notes, and snippets.

View bndynet's full-sized avatar

Bendy Zhang bndynet

View GitHub Profile
@bndynet
bndynet / myisam-vs-innodb.md
Last active November 6, 2018 01:51
MyISAM vs InnoDB

MyISAM和InnoDB都使用B+树来实现索引:

  • MyISAM的索引与数据分开存储

  • MyISAM的索引叶子存储指针,主键索引与普通索引无太大区别

  • InnoDB的聚集索引和数据行统一存储

  • InnoDB的聚集索引存储数据行本身,普通索引存储主键

@bndynet
bndynet / amd-cmd-umd-commonjs.md
Last active February 21, 2024 13:13
AMD、CMD、UMD、CommonJS

Over the years there’s been a steadily increasing ecosystem of JavaScript components to choose from. The sheer amount of choices is fantastic, but this also infamously presents a difficulty when components are mixed-and-matched. And it doesn’t take too long for budding developers to find out that not all components are built to play nicely together.

To address these issues, the competing module specs AMD and CommonJS have appeared on the scene, allowing developers to write their code in an agreed-upon sandboxed and modularized way, so as not to “pollute the ecosystem”.

AMD(Asynchromous Module Definition)

Asynchronous Module Definition (AMD) has gained traction on the frontend, with RequireJS being the most popular implementation.

Here’s module foo with a single dependency on jquery:

@bndynet
bndynet / jquery-linked-dropdown-list.md
Created September 4, 2018 08:54
jQuery - Linked Dropdown List
$.fn.extend({
    // options: [{label: '', css: '', valueProperty: '', textProperty: '', selectedValue: '', childProperty: ''}, {...}]
    linkedDropdownList: function(data, options) {
        var _this = $(this);
        var id = _this.attr('id') + '_linkedDDL';
        var selectedObjects = [];
        var elFields = [];
        var elContainer = $('<div id="' + id + '"></div>');
        _this.append(elContainer);
@bndynet
bndynet / oauth2-mysql-schema.md
Created August 6, 2018 07:03
OAuth2 MySQL Schema
USE oauth;

CREATE TABLE oauth_client_details (
    client_id VARCHAR(255) PRIMARY KEY,
    client_name VARCHAR(255),
    client_secret VARCHAR(255),
    resource_ids VARCHAR(255),
    scope VARCHAR(255),
    authorized_grant_types VARCHAR(255),
@bndynet
bndynet / index.html
Created July 26, 2018 09:08
styles for in-process
<label>
<i class="icon-loading"></i> Loading
</label>
@bndynet
bndynet / api-design-guide.md
Last active July 26, 2018 01:53
API Design Guide

Describe how to build best popular APIs

Use RESTful service URLs

Under REST principles, a URL identifies a resource. The following URL design patterns are considered REST best practices:

  • URLs should include nouns, not verbs.
  • Use plural nouns only for consistency (no singular nouns).
  • Use HTTP methods (HTTP/1.1) to operate on these resources:
@bndynet
bndynet / xvfb.md
Created July 10, 2018 02:37
Xvfb - X virtual frame buffer

Xvfb, or X virtual frame buffer is needed by selenium and chromedriver or gekodriver, so it can srun via cron with your PC locked, or without your script taking focus from the user section

Install Xvfb on CentOS

  • yum install xorg-x11-server-Xvfb

  • Copy below to /etc/systemd/system/Xvfb.service

@bndynet
bndynet / file-download-via-ajax.md
Last active May 22, 2018 08:18
File Download via AJAX

Describe how to use ajax to download files.

<button type="button" id="GetFile">Get File!</button>
$('#GetFile').on('click', function () {
    $.ajax({
 url: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/172905/test.pdf',
@bndynet
bndynet / javascript.md
Last active May 21, 2018 06:47
JavaScript Knowledge

Records complex knowledge about JavaScript programming language.


Promise

Syntax

new Promise( /* executor */ function(resolve, reject) { ... } );

@bndynet
bndynet / mysql.md
Last active May 21, 2018 06:21
MySQL Knowledge

Records complex knowledge about MySQL


Installation

Using the MySQL Yum Repository