Skip to content

Instantly share code, notes, and snippets.

View bndynet's full-sized avatar

Bendy Zhang bndynet

View GitHub Profile
@bndynet
bndynet / Example-for-Angular-Unit-Test.md
Last active March 1, 2017 08:38
Example for Angular Unit Test

Example for Angular Unit Test

describe('Unit testing great quotes', function() {
  var $compile,
      $rootScope;

  // Load the myApp module, which contains the directive
  beforeEach(funtction(){
    module('myApp'));
@bndynet
bndynet / Install-MariaDB-on-CentOS7.md
Last active March 1, 2017 06:11
Install MariaDB on CentOS 7

Before You Begin

Ensure that you have followed the Getting Started and Securing Your Server guides, and the Linode’s hostname is set.

To check your hostname run:

hostname
hostname -f

The first command should show your short hostname, and the second should show your fully qualified domain name (FQDN).

@bndynet
bndynet / Testing-AngularJS-with-Grunt-Karma-and-Jasmine.md
Last active April 4, 2018 07:23
Testing AngularJS with Grunt, Karma, and Jasmine

Set up environment for AngularJS testing with Grunt, Karma and Jasmine

Setup Environment

npm install karma --save-dev  
npm install karma-jasmine --save-dev  
npm install karma-phantomjs-launcher --save-dev

npm install grunt-karma --save-dev
@bndynet
bndynet / mysql-in-python.md
Last active April 4, 2018 07:21
MySql in Python

Hello World in Python with MySql

sudo easy_install pip
sudo pip install mysql-connector
python

>>> import mysql.connector
>>> conn = mysql.connector.connect(user='root', password='pwd', host='192.168.241.129', database='test')
>>> cur = conn.cursor()
@bndynet
bndynet / Hello-World.md
Last active April 4, 2018 07:21
Hello World

Hello World for All Programming Languages

Node.js

const http = require('http');

const hostname = '127.0.0.1';
const port = 3000;
@bndynet
bndynet / angular-directive-color-picker.md
Last active April 4, 2018 07:20
Angular Directive - Color Picker

Color Picker Directive for AngularJS

Requires

  • bootstrap

Code

"use strict"
@bndynet
bndynet / commit_message_style_guide.md
Last active November 21, 2020 23:26
Commit Message Style Guide

Recommendation for Git Commit Message

The Type

The type is contained within the title and can be one of these types:

  • feat: a new feature
  • fix: a bug fix
  • docs: changes to documentation
  • style: formatting, missing semi colons, etc; no code change
  • refactor: refactoring production code
@bndynet
bndynet / Enabling-CORS.md
Created May 24, 2017 01:22
Spring Boot Enabling CORS

Enabling CORS

Controller method CORS configuration

So that the RESTful web service will include CORS access control headers in its response, you just have to add a @CrossOrigin annotation to the handler method:

src/main/java/hello/GreetingController.java

@CrossOrigin(origins = "http://localhost:9000")

@GetMapping("/greeting")

@bndynet
bndynet / git-commit-emojis.md
Last active October 12, 2017 06:44 — forked from jhermann/git-commit-emojis.md
Useful emoji for git commit messages

Useful emoji for git commit messages

Emoji

If you add emoji to your commit messages for a GitHub repo, they become less boring, and you can convey the kind of change you're adding. See the full set of GitHub supported emoji here (also useful for easy copy&paste via a simple click).

Example commit message

@bndynet
bndynet / how-to-publish-package-to-npm.md
Last active May 23, 2018 07:48
How to publish package to NPM

Steps for publishing or updating npm package

npm adduser if you don't have one

npm login enter your name and password

npm publish publish public package

npm version [patch|minor|major] update version