Skip to content

Instantly share code, notes, and snippets.

View phenrique7's full-sized avatar
✝️
Soli Deo gloria

Paulo Henrique phenrique7

✝️
Soli Deo gloria
View GitHub Profile

Cheat sheet: Arrays

JavaScript Arrays are a very flexible data structure and used as lists, stacks, queues, tuples (e.g. pairs), etc. Some

Using Arrays

Creating Arrays, reading and writing elements:

@sibelius
sibelius / testingConcept.md
Last active February 1, 2024 17:36
testing library concept and basic test

You first need to undestand the concept of frontend tests.

You should not test the implementation but the behavior

You test like the end user

For instance, imagine a login screen with email and password inputs and a submit button

The test should input the email and the password, then click in the submit button.

@Rikezenho
Rikezenho / italian-gesture.js
Last active November 25, 2020 16:18
A snippet to make an italian gesture hand appear in page
(function () {
var url = 'https://i.kym-cdn.com/photos/images/newsfeed/001/331/288/371.png';
var image = new Image();
image.src = url;
image.width = 300;
image.style = 'position: fixed; bottom: 20px; transform: translateX(-1000px); transition: all 0.5s ease; animation: anim 2s 2s;';
var style = document.createElement('style');
style.innerHTML = '@keyframes anim { 15% { transform: translateX(-40px); } 25% { transform: translateX(-40px) rotate(45deg); } 50% { transform: translateX(-40px) rotate(0deg); } 75% { transform: translateX(-40px) rotate(45deg); } 90% { transform: translateX(-40px) rotate(0deg); } 99% { transform: translateX(-1000px) rotate(45deg); } }';
document.body.appendChild(style);
document.body.appendChild(image);
@swyxio
swyxio / 1.md
Last active February 8, 2024 22:30
Learn In Public - 7 opinions for your tech career

2019 update: this essay has been updated on my personal site, together with a followup on how to get started

2020 update: I'm now writing a book with updated versions of all these essays and 35 other chapters!!!!

1. Learn in public

If there's a golden rule, it's this one, so I put it first. All the other rules are more or less elaborations of this rule #1.

You already know that you will never be done learning. But most people "learn in private", and lurk. They consume content without creating any themselves. Again, that's fine, but we're here to talk about being in the top quintile. What you do here is to have a habit of creating learning exhaust. Write blogs and tutorials and cheatsheets. Speak at meetups and conferences. Ask and answer things on Stackoverflow or Reddit. (Avoid the walled gardens like Slack and Discourse, they're not public). Make Youtube videos

@sebmarkbage
sebmarkbage / The Rules.md
Last active May 13, 2024 06:47
The Rules of React

The Rules of React

All libraries have subtle rules that you have to follow for them to work well. Often these are implied and undocumented rules that you have to learn as you go. This is an attempt to document the rules of React renders. Ideally a type system could enforce it.

What Functions Are "Pure"?

A number of methods in React are assumed to be "pure".

On classes that's the constructor, getDerivedStateFromProps, shouldComponentUpdate and render.

@vinicius73
vinicius73 / 0-contribua-.md
Last active February 9, 2024 10:10
Guia de referencias sobre estudo de JavaScript

Contribua

Se você quiser adicionar mais algum tópico deixe seu comentário, o objetico é facilitar para os iniciantes ou aqueles que buscam dominar JavaScript, quais tópicos são importantes para dominar JavaScript.

São tópicos para quem sabe o minimo de JavaScript (declarar variáveis), a ordem em que eles aparecem são por importância para o dominio como um todo. Mesmo que você já tenha experiência com JS, recomendo que leia os links de cada tópico para fortalecer suas bases teóricas e ter um comportamento mais profundo da linguagem.

Lista originalmente criada e compilada por Vinicius Reis

@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 19, 2024 10:52
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@wojteklu
wojteklu / clean_code.md
Last active May 19, 2024 03:34
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@peterpham
peterpham / console-happy-birthday.js
Created April 12, 2016 03:27
Create a message Happy Birthday in browser's console
(function(){
var text = "Happy Birthday, Steve!",
length = text.length,
chr = 1,
ar = text.split(),
today = new Date();
try {
if (window.console) {
if (console.clear && console.log) {
if (today.getDate() === 17 && today.getMonth() === 2) {