Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit eee8246

Browse files
update readme/added some folders
1 parent 8ef2632 commit eee8246

File tree

10 files changed

+273
-33
lines changed

10 files changed

+273
-33
lines changed

‎12-objects.html

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8">
5-
<title>Objects - Programador a bordo</title>
5+
<title>Objects</title>
66
</head>
77
<body>
88
<script>
@@ -165,27 +165,6 @@
165165
console.log(usuario.atual); // { nome: 'Maria', idade: 21 }
166166

167167

168-
169-
170-
171-
172-
173-
174-
175-
176-
177-
178-
179-
180-
181-
182-
183-
184-
185-
186-
187-
188-
189168
</script>
190169
</body>
191170
</html>

‎16-closures.html

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8">
5-
<title>Closures - Programador a bordo</title>
5+
<title>Closures</title>
66
</head>
77
<body>
88
<script>
@@ -60,17 +60,8 @@
6060
let nome = 'Ayrton';
6161
setTimeout(imprimeNomeCompleto(nome), 1000)
6262
}
63-
6463
inicializa();
65-
66-
67-
68-
69-
70-
71-
72-
73-
64+
7465
</script>
7566
</body>
7667
</html>

‎Email Mask - CodigoFonteTV.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
Create a Mask in an email address
3+
This function create a mask using a valid email address.
4+
This is usefull when someone need to confirm the email used in a system
5+
Author: Gabriel Froes - https://gist.github.com/gabrielfroes
6+
*/
7+
function emailMask(email) {
8+
var maskedEmail = email.replace(/([^@\.])/g, "*").split('');
9+
var previous = "";
10+
for(i=0;i<maskedEmail.length;i++){
11+
if (i<=1 || previous == "." || previous == "@"){
12+
maskedEmail[i] = email[i];
13+
}
14+
previous = email[i];
15+
}
16+
return maskedEmail.join('');
17+
}
18+
19+
// Usage:
20+
// console.log ( emailMask("my.email@mydomain.com") );
21+
// Output: my.e****@m*******.c**

‎Jogo da Velha - CodigoFonteTV/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Tic Tac Toe
2+
3+
Created by [#CDFTV channel](https://www.youtube.com/codigofontetv).
4+
This game was built to make an integration between our Youtube Channel and the subscribers.
5+
6+
Feel free to contribute with improvements and features. Your PRs will be evaluated.
7+
8+
Cheers!
9+
Gabriel & Vanessa
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
body {
2+
margin: 0;
3+
display: flex;
4+
flex-direction: column;
5+
align-items: center;
6+
}
7+
8+
.game {
9+
width: 100vw;
10+
height: 100vw;
11+
margin: 0 auto;
12+
background-color: #34495e;
13+
color: #fff;
14+
display: grid;
15+
grid-template: repeat(3, 1fr) / repeat(3, 1fr)
16+
}
17+
18+
.game>div {
19+
border: 6px solid #2c3e50;
20+
font-family: Helvetica;
21+
font-weight: bold;
22+
font-size: 4em;
23+
display: flex;
24+
justify-content: center;
25+
align-items: center;
26+
}
27+
28+
.btn {
29+
border: 5px solid #2c3e50;
30+
background-color: #34495e;
31+
color: white;
32+
margin-top: 10px;
33+
padding: 10px 20px
34+
}
35+
36+
.game > div.winner {
37+
background: yellow;
38+
}
39+
40+
.game > div.winner > span {
41+
color: blue;
42+
}
43+
44+
@media (min-width: 600px) {
45+
.game {
46+
width: 600px;
47+
height: 600px;
48+
border-radius: 10px;
49+
border: 6px solid #2c3e50;
50+
}
51+
52+
.game>div {
53+
border-radius: 2px;
54+
}
55+
}
56+
57+
@media (min-width: 1024px) {
58+
.btn {
59+
cursor: pointer
60+
}
61+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Tic Tac Toe</title>
8+
<link rel="stylesheet" href="css/style.css">
9+
</head>
10+
<body>
11+
12+
<div class='game'></div>
13+
<button class="btn" onclick="tic_tac_toe.restart()" title="Restart this game">Restart</button>
14+
15+
<script src="js/tic-tac-toe.js"></script>
16+
<script>
17+
tic_tac_toe.init( document.querySelector('.game') );
18+
tic_tac_toe.start();
19+
</script>
20+
21+
</body>
22+
</html>
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
// TIC TAC TOE
2+
const tic_tac_toe = {
3+
4+
// ATTRIBUTES
5+
board: ['','','','','','','','',''],
6+
symbols: {
7+
options: ['O','X'],
8+
turn_index: 0,
9+
change(){
10+
this.turn_index = ( this.turn_index === 0 ? 1:0 );
11+
}
12+
},
13+
container_element: null,
14+
gameover: false,
15+
winning_sequences: [
16+
[0,1,2],
17+
[3,4,5],
18+
[6,7,8],
19+
[0,3,6],
20+
[1,4,7],
21+
[2,5,8],
22+
[0,4,8],
23+
[2,4,6]
24+
],
25+
26+
// FUNCTIONS
27+
init(container) {
28+
this.container_element = container;
29+
},
30+
31+
make_play(position) {
32+
if (this.gameover || this.board[position] !== '') return false;
33+
34+
const currentSymbol = this.symbols.options[this.symbols.turn_index];
35+
this.board[position] = currentSymbol;
36+
this.draw();
37+
38+
const winning_sequences_index = this.check_winning_sequences(currentSymbol);
39+
if (this.is_game_over()){
40+
this.game_is_over();
41+
}
42+
if (winning_sequences_index >= 0) {
43+
this.game_is_over();
44+
this.stylize_winner_sequence(this.winning_sequences[winning_sequences_index]);
45+
} else {
46+
this.symbols.change();
47+
}
48+
49+
return true;
50+
},
51+
52+
stylize_winner_sequence(winner_sequence) {
53+
winner_sequence.forEach((position) => {
54+
this
55+
.container_element
56+
.querySelector(`div:nth-child(${position + 1})`)
57+
.classList.add('winner');
58+
});
59+
},
60+
61+
check_winning_sequences(symbol) {
62+
63+
for ( i in this.winning_sequences ) {
64+
if (this.board[ this.winning_sequences[i][0] ] == symbol &&
65+
this.board[ this.winning_sequences[i][1] ] == symbol &&
66+
this.board[ this.winning_sequences[i][2] ] == symbol) {
67+
console.log('winning sequences INDEX:' + i);
68+
return i;
69+
}
70+
};
71+
return -1;
72+
},
73+
74+
game_is_over() {
75+
this.gameover = true;
76+
console.log('GAME OVER');
77+
},
78+
79+
is_game_over() {
80+
return !this.board.includes('');
81+
},
82+
83+
start() {
84+
this.board.fill('');
85+
this.draw();
86+
this.gameover = false;
87+
},
88+
89+
restart() {
90+
if (this.is_game_over() || this.gameover) {
91+
this.start();
92+
console.log('this game has been restarted!')
93+
} else if (confirm('Are you sure you want to restart this game?')) {
94+
this.start();
95+
console.log('this game has been restarted!')
96+
}
97+
},
98+
99+
draw() {
100+
this.container_element.innerHTML = this.board.map((element, index) => `<div onclick="tic_tac_toe.make_play('${index}')"> ${element} </div>`).reduce((content, current) => content + current);
101+
},
102+
};

‎Start Reactor - CodigoFonteTV

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 51892a3e10e44a3d462bde74ea53ecdc3316e887

‎datetime_timestamp.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Pegar do horário atual
2+
var timestamp = new Date().getTime();
3+
console.log(timestamp)
4+
5+
// Pegar de uma data específica
6+
var timestamp2 = new Date(2013, 11, 17).getTime();
7+
console.log(timestamp2)
8+
9+
let now = new Date();
10+
let day = now.getDate();
11+
let month = now.getMonth()+1;
12+
let year = now.getFullYear();
13+
let hours = now.getHours();
14+
let minutes = now.getMinutes();
15+
let seconds = now.getSeconds();
16+
17+
function fixZero(time){
18+
return time < 10 ? `0${time}` : time;
19+
}
20+
21+
console.log(now, fixZero(hours), fixZero(minutes), fixZero(seconds));
22+
console.log(new Date().toLocaleString());
23+
console.log(`${fixZero(day)}/${fixZero(month)}/${year} ${fixZero(hours)}:${fixZero(minutes)}:${fixZero(seconds)}`)

‎slugify.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
Create SLUG from a string
3+
This function rewrite the string prototype and also
4+
replace latin and other special characters.
5+
Forked by Gabriel Froes - https://gist.github.com/gabrielfroes
6+
Original Author: Mathew Byrne - https://gist.github.com/mathewbyrne/1280286
7+
*/
8+
if (!String.prototype.slugify) {
9+
String.prototype.slugify = function () {
10+
11+
return this.toString().toLowerCase()
12+
.replace(/[àÀáÁâÂãäÄÅåa]+/g, 'a') // Special Characters #1
13+
.replace(/[èÈéÉêÊëË]+/g, 'e') // Special Characters #2
14+
.replace(/[ìÌíÍîÎïÏ]+/g, 'i') // Special Characters #3
15+
.replace(/[òÒóÓôÔõÕöÖo]+/g, 'o') // Special Characters #4
16+
.replace(/[ùÙúÚûÛüÜ]+/g, 'u') // Special Characters #5
17+
.replace(/[ýÝÿŸ]+/g, 'y') // Special Characters #6
18+
.replace(/[ñÑ]+/g, 'n') // Special Characters #7
19+
.replace(/[çÇ]+/g, 'c') // Special Characters #8
20+
.replace(/[ß]+/g, 'ss') // Special Characters #9
21+
.replace(/[Ææ]+/g, 'ae') // Special Characters #10
22+
.replace(/[Øøœ]+/g, 'oe') // Special Characters #11
23+
.replace(/[%]+/g, 'pct') // Special Characters #12
24+
.replace(/\s+/g, '-') // Replace spaces with -
25+
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
26+
.replace(/\-\-+/g, '-') // Replace multiple - with single -
27+
.replace(/^-+/, '') // Trim - from start of text
28+
.replace(/-+$/, ''); // Trim - from end of text
29+
30+
};
31+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /