Skip to content

Instantly share code, notes, and snippets.

View vinicius5581's full-sized avatar
:octocat:
Chilling

Vinicius Santana vinicius5581

:octocat:
Chilling
View GitHub Profile

Getting Started

  1. Install dependencies
npm install
  1. Create a config.js file with Github token to link to Atlier API. If you do not have access, reference the server code to create the backened to supply the data.
@vinicius5581
vinicius5581 / Tic-tac-toe.js
Last active February 1, 2021 07:25
Tic Tac Toe - Using Class - v 0.0.1
export default class TicTacToe{
constructor(el){
this.el = document.getElementById(el);
this.setupNewGame();
this.setupEventHandlers();
}
setupNewGame() {
this.gameState = [null, null, null, null, null, null, null, null, null];
this.currentPlayer = "X";
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Fun';
}
import Component from '@glimmer/component';
export default class extends Component {
}
@vinicius5581
vinicius5581 / concessionaria.sql
Created April 26, 2020 03:23
Banco de dados simplificado de uma concessionaria de carros fictícia com fins únicos de servir de exemplo para o blog post sobre usando SQL com MySQL.
DROP DATABASE IF EXISTS `concessionaria`;
CREATE DATABASE `concessionaria` ;
USE `concessionaria`;
CREATE TABLE `carros`(
`id_do_carro` int(11) NOT NULL AUTO_INCREMENT,
`nome` varchar(50) NOT NULL,
`cor` varchar(50) NOT NULL,
`quantidade_em_estoque` int(11) NOT NULL,
`preco` decimal(8,2) NOT NULL,
@vinicius5581
vinicius5581 / custom-with-callback.js
Last active April 13, 2020 04:01
Array.prototype
const numbersArray = [1, 2, 3, 4];
const logTimesTwo = num => console.log(num * 2);
const customForEach = (arr, cb) => {
for (let i = 0; i < arr.length; i++) {
cb(arr[i]);
}
}
@vinicius5581
vinicius5581 / reverseString.js
Last active January 9, 2020 18:09
Reverser string with a reverse for loop
function reverseString(str) {
// Step 1. Create an empty string that will host the new created string
var newString = "";
// Step 2. Create the FOR loop
/* The starting point of the loop will be (str.length - 1) which corresponds to the
last character of the string, "o"
As long as i is greater than or equals 0, the loop will go on
We decrement i after each iteration */
for (var i = str.length - 1; i >= 0; i--) {
@vinicius5581
vinicius5581 / getNeighboors.js
Created December 17, 2019 08:35
Find matrix point neighbors
const getNeighboors = (matrix, row,col) => {
let isTopBorder = row === 0;
let isRightBorder = col === matrix[row].length - 1;
let isBottomBorder = row === matrix.length - 1;
let isLeftBorder = col === 0;
let top = isTopBorder ? row : row - 1;
let left = isLeftBorder ? col : col - 1;
let bottom = isBottomBorder ? row : row + 1;