Skip to content

Instantly share code, notes, and snippets.

View punneng's full-sized avatar

Surasit Liangpornrattana punneng

View GitHub Profile
// this function recieves balance which is not really in this unit scope.
// so we dont need to care what balance.getBalance() does.
static double getBalanceWithDecimalPoint(Balance balance, int dp) throws NegativeBalanceException {
if (balance.getBalance() < 0) {
throw new NegativeBalanceException();
}
System.out.println("Converting to " + dp + "decimal point");
return balance.getBalance();
}
@punneng
punneng / DbHeper.java
Last active December 11, 2017 16:04
pre-test and post-test
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.mycompany.mavenproject1;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
find . -name '*.flv' -exec cp {} ./videos/ \;
# [finds all files which contain '.flv' in the name in this folder and copies them to videos]
grep -Hin 'msg' ./*
# finds in folder
{
"workbench.colorTheme": "Sunburst",
"editor.fontFamily": "Monaco, 'Courier New', monospace",
"window.zoomLevel": 0,
"editor.tabSize": 2,
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/tmp": true,
"**/log": true
@punneng
punneng / ExampleOfPrivateMemberDeclaring.js
Created August 3, 2012 08:24
How to declare private properties/methods
function myPowerConstructor(x) {
var that = otherMaker(x);
var secret = f(x);
that.priv = function () {
... secret x that ...
};
return that;
}