Skip to content

Instantly share code, notes, and snippets.

Avatar
😊
It's working ....

Sampath Thennakoon sampathsl

😊
It's working ....
View GitHub Profile
View hello_mysql.go
package main
import (
"database/sql"
"log"
_ "github.com/go-sql-driver/mysql"
)
func main() {
db, err := sql.Open("mysql", "root:@tcp(:3306)/test")
@sampathsl
sampathsl / gist:69658c600735cc440022
Last active Sep 21, 2015 — forked from moraes/gist:2141121
LIFO Stack and FIFO Queue in golang
View gist:69658c600735cc440022
package main
import (
"fmt"
)
type Node struct {
Value int
}
@sampathsl
sampathsl / ConflictFix.js
Last active Dec 13, 2015
jQuery with Prototype usage
View ConflictFix.js
// Code that uses other library's $ can follow here.
var jQuery = $.noConflict(true);
@sampathsl
sampathsl / jquery_multiple_version_fix.js
Last active Dec 13, 2015
jQuery multiple versions in a single page
@sampathsl
sampathsl / index4.js
Created Dec 13, 2015
ES6 Class Support
View index4.js
class Vehicle {
constructor(){
this.type = 'Vehicle';
}
getBrand(val){
console.log('Type: ' + val + ', This is a ' + this.type);
}
}
class Car extends Vehicle{
@sampathsl
sampathsl / index3.js
Created Dec 13, 2015
ES6 - Const keyword
View index3.js
const PI = Math.PI;
console.log(PI);
//Can not assign value - TypeError: invalid assignment to const 'PI'
//PI = '1';
@sampathsl
sampathsl / index2.js
Created Dec 13, 2015
ES6 - var vs let keywords
View index2.js
let checkDataLet = 'Test';
console.log('Outside let showES6Features: ' + checkDataLet);
while(true){
//let key word
let checkDataLet = 'Poop!';
console.log('Inside let showES6Features: ' + checkDataLet);
break;
}
@sampathsl
sampathsl / index5.js
Last active Dec 13, 2015
Arrow Function Usage
View index5.js
//ES 5
function isBigEnough(value) {
return value >= 10;
}
var filtered = [12, 5, 8, 130, 44].filter(isBigEnough);
console.log(filtered);
//ES 6
let filtered_extended = [12, 5, 8, 130, 44].filter((e) => {
return e >= 10;
You can’t perform that action at this time.