Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume-N committed Jul 26, 2018
0 parents commit 164d457
Show file tree
Hide file tree
Showing 60 changed files with 859 additions and 0 deletions.
112 changes: 112 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@

# Created by https://www.gitignore.io/api/node,sublimetext

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless

### SublimeText ###
# Cache files for Sublime Text
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache

# Workspace files are user-specific
*.sublime-workspace

# Project files should be checked into the repository, unless a significant
# proportion of contributors will probably not be using Sublime Text
# *.sublime-project

# SFTP configuration file
sftp-config.json

# Package control specific files
Package Control.last-run
Package Control.ca-list
Package Control.ca-bundle
Package Control.system-ca-bundle
Package Control.cache/
Package Control.ca-certs/
Package Control.merged-ca-bundle
Package Control.user-ca-bundle
oscrypto-ca-bundle.crt
bh_unicode_properties.cache

# Sublime-github package stores a github token in this file
# https://packagecontrol.io/packages/sublime-github
GitHub.sublime-settings


# End of https://www.gitignore.io/api/node,sublimetext
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bonjour
Binary file added client/big-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions client/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>Casa del hack</title>
<link rel="stylesheet" href="style.css">
<script src="scripts/axios/dist/axios.min.js"></script>
<script src="index.js"></script>

</head>
<body>
<!-- page content -->
</body>
</html>
80 changes: 80 additions & 0 deletions client/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// const axios = require('axios');

const http = axios
const apiUrl = 'http://localhost:3000'

const getRandomInt = (min, max) => Math.floor(Math.random() * (max - min + 1) + min)

const allCheerzers = ['Milisa', 'Romain', 'Marie-Blanche', 'Sara', 'Guillaume', 'Elodie', 'Elif', 'Robin',
'Thomas', 'DavidG', 'Arnaud', 'Hugo', 'Kevin', 'DavidP', 'Leo', 'Denis', 'Johnny', 'Charles', 'Tom', 'Melissa', 'Thiefaine', 'AlexandreW', 'Aminata', 'AlexandreC',
'Daniel', 'Charlotte', 'Theo', 'Maxime', 'Raphaele', 'Yao', 'Cindy', 'Ana', 'Pierre', 'Damien', 'Amel', 'Tristan', 'Maxime', 'Maria', 'Mapy', 'Sandra', 'Marie-Julia',
'Julien', 'Mathieu', 'Valentine', 'Aurel', 'Antoine', 'Bea', 'Valeria', 'Denisse']

const getAvailableCheerzers = () => {
return http.get(apiUrl+'/cheerzers')
.then(response => {
// console.log(response.data)
return response.data
})
.catch(err => {
console.log(err)
return undefined
})
}

const updateAvailability = (name) => {
http.post(apiUrl+'/cheerzers', {name})
.then(response => {
console.log(response.data)
})
.catch(err => console.log(err))
}

const deleteAvailability = (name) => {
console.log('here', availableCheerzers)
const cheerzerToDelete = availableCheerzers.find(cheerzer => cheerzer.name === name)

return http.put(apiUrl+'/cheerzers/'+cheerzerToDelete.id, {name, available: false})
.then(response => {
console.log(response.data)
})
.catch(err => console.log(err))
}

let availableCheerzers = []

getAvailableCheerzers().then(res => {
availableCheerzers = res
})


/*
setTimeout(() => {
deleteAvailability('Guillaume')
}, 1000)
*/



/*
const player = 'Guillaume'
const getFourPeople = () => {
const cheerzers = allCheerzers.slice(0, allCheerzers.length).filter(c => c != player)
const selectedCheerzers = []
for(let i = 0; selectedCheerzers.length < 4; i++) {
const randomInt = getRandomInt(0, cheerzers.length)
const randomCheerzer = cheerzers[randomInt]
if(!selectedCheerzers.includes(randomCheerzer)) {
selectedCheerzers.push(randomCheerzer)
}
}
console.log(selectedCheerzers)
}
getFourPeople()
*/
Loading

0 comments on commit 164d457

Please sign in to comment.