Skip to content

Instantly share code, notes, and snippets.

View victorsteven's full-sized avatar

Victor Steven victorsteven

View GitHub Profile
@victorsteven
victorsteven / test.js
Last active August 1, 2019 18:47
test file
import chai from 'chai';
import chatHttp from 'chai-http';
import 'chai/register-should';
import app from '../index';
chai.use(chatHttp);
const { expect } = chai;
describe('Testing the book endpoints:', () => {
it('It should create a book', (done) => {
@victorsteven
victorsteven / .travis.yml
Created April 20, 2019 22:38
travis file
language: node_js
node_js:
- "stable"
cache:
directories:
- "node_modules"
install:
- npm install
services:
- postgresql
@victorsteven
victorsteven / package.json
Created April 20, 2019 23:01
Package.json file
{
"name": "book-app",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "nodemon --exec babel-node ./api/index.js",
"test": "export NODE_ENV=test && sequelize db:migrate:undo:all && sequelize db:migrate && nyc --require @babel/register mocha ./api/test/test.js --timeout 20000 --exit",
"build": "rm -rf ./build && babel -d ./build ./api -s",
"generate-lcov": "nyc report --reporter=text-lcov > lcov.info",
package main
import "fmt"
//Package scope array definition
var integerArray [5]int
var stringArray [4]string
func main() {
package main
import "fmt"
func main() {
//Function scope array:
integerArray := [5]int{10, 20, 30, 40, 50}
stringArray := [4]string{"first", "second", "third", "fourth"}
package main
import "fmt"
//Package scope array definition
var integerSlice []int
var stringSlice []string
func main() {
package main
import "fmt"
func main() {
//Function scope slice:
//EXAMPLE 1:
integerSlice := []int{10, 20, 30, 40, 50}
package main
import "fmt"
func main() {
s := make([]int, 4)
s[0] = 10
s[1] = 20
s[2] = 30
package main
import "fmt"
func main() {
s := []int{10, 20, 30, 40}
// We can loop through this slice in two ways:
package main
import "fmt"
func main() {
//Example 1:
nested := make([][]int, 0, 3)
for i := 0; i < 3; i++ {
out := make([]int, 0, 4)