by alexander white ©
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"database/sql" | |
"log" | |
_ "github.com/go-sql-driver/mysql" | |
) | |
func main() { | |
db, err := sql.Open("mysql", "root:@tcp(:3306)/test") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
type Node struct { | |
Value int | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.noConflict(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code that uses other library's $ can follow here. | |
var jQuery = $.noConflict(true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Vehicle { | |
constructor(){ | |
this.type = 'Vehicle'; | |
} | |
getBrand(val){ | |
console.log('Type: ' + val + ', This is a ' + this.type); | |
} | |
} | |
class Car extends Vehicle{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const PI = Math.PI; | |
console.log(PI); | |
//Can not assign value - TypeError: invalid assignment to const 'PI' | |
//PI = '1'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let checkDataLet = 'Test'; | |
console.log('Outside let showES6Features: ' + checkDataLet); | |
while(true){ | |
//let key word | |
let checkDataLet = 'Poop!'; | |
console.log('Inside let showES6Features: ' + checkDataLet); | |
break; | |
} |
OlderNewer