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
@vinicius5581
vinicius5581 / arrays.js
Last active October 19, 2019 20:18
Array basics
const frutas = ['MaΓ§Γ£', 'Banana'];
const fruits = ["MaΓ§Γ£", "Manga", "Uva", "Laranja", "MaΓ§Γ£", "Manga", "Banana", "Banana"]
console.log('adciona no comeco - unshift')
console.log(frutas.unshift('Laranja'))
console.log(frutas)
console.log('remove no comeco - shift')
console.log(frutas.shift())
console.log(frutas)
const p1 = {
name: 'p1',
sayHi: function(){console.log('hi')}
}
function Person(name) {
this.name = name;
this.sayHi = function(){console.log('hi')};
}
class Thing {
constructor(isLiving){
this.isLiving = isLiving;
}
doSomething() {
console.log('doing some')
}
}
// Class
class Emitter {
constructor (events = []) {
this.events = new Map(events)
}
on (name, cb) {
this.events.set(name, [...(this.events.get(name) || []), cb])
return () => this.events.set(name, this.events.get(name).filter(fn => fn !== cb))
const debounce = (fn, time) => {
let timerId = null
return (...args) => {
if (timerId) {
clearTimeout(timeId)
}
timeId = setTimeout(() => {
fn(...args)
}, time)
}
console.log("πŸ₯ͺπŸ…πŸπŸ‘πŸ“πŸ˜›πŸ˜­πŸ˜¬πŸ’©");
@vinicius5581
vinicius5581 / Python_oop_101.py
Created February 21, 2019 03:47
Helping Anastasia with her Python journey
# def sum(a, b):
# return a + b
# print(1 + 2)
# print(1 + 3)
# print(sum(1, 2))
@vinicius5581
vinicius5581 / GitHub-Forking.md
Created November 20, 2018 08:11 — forked from Chaser324/GitHub-Forking.md
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

function maxSquareWithinHistoragram(historagram) {
let maxArea = 0;
const barStack = [];
let i = 0;
while (i < historagram.length) {
if (!barStack.length || historagram[barStack[barStack.length - 1]] <= historagram[i]) {
barStack.push(i);
i++;
} else {
const currentHeight = historagram[barStack.pop()];
const matrix = [
[1,1,1,0,1],
[0,1,1,1,0],
[1,1,1,1,1],
[0,1,1,1,1],
[1,1,1,0,1]
];
function findLargestSquareOf1s(matrix) {
let max = 0;