Skip to content

Instantly share code, notes, and snippets.

View arthurbergmz's full-sized avatar
🔮
curiosity keeps leading us down new paths

Arthur A. Bergamaschi arthurbergmz

🔮
curiosity keeps leading us down new paths
View GitHub Profile
@arthurbergmz
arthurbergmz / cors.md
Created February 23, 2022 13:49 — forked from liamgriffiths/cors.md
How CORS works

Guide to CORS

CORS (cross origin resource sharing) is a mechanism to allow client web applications make HTTP requests to other domains. For example if you load a site from http://domainA.com and want to make a request (via xhr or img src, etc) to http://domainB.com without using CORS your web browser will try to protect you by blocking the response from the other server. This is because browsers restrict responses coming from other domains via the Same-Origin-Policy.

CORS allows the browser to use reponses from other domains. This is done by including a Access-Control headers in the server responses telling the browser that requests it is making is OK and safe to use the response.

Header Description
Access-Control-Allow-Origin: Allow requests from `` to access t

Docker studies

Docker is an engine that runs containers. Containers allow you to solve many challenges created in the growing DevOps trend. It is made of the Docker Engine, Docker CLI and Docker Registry.

Docker CLI is where the "business logic" is, establishing an interface so you can take advantage of the Docker Engine and Docker Registry from a terminal/console.

Why Docker is useful

When a server application needs to handle a higher usage than what a single server can handle, the solution is well-known, place a reverse proxy in front of it, and duplicate the server as many times as needed.

@arthurbergmz
arthurbergmz / gist:87e0171fba17b730b1f09f0251356e0e
Created January 3, 2020 05:01 — forked from taylorhughes/gist:4dc50b2fe674c0a84cc6
Update Facebook token in iOS client from existing server-side cached token
[self.apiClient retrieveConnectedServicesWithSuccessBlock:^(NSDictionary *services) {
NSArray *facebookTokens = services[@"facebook"];
if (facebookTokens.count == 0) {
return;
}
NSDictionary *mostRecentFacebookTokenDict = facebookTokens[0];
NSNumber *refreshTimeNumber = mostRecentFacebookTokenDict[@"refreshTime"];
NSDate *refreshDate = [NSDate dateWithTimeIntervalSince1970:[refreshTimeNumber doubleValue]];
@arthurbergmz
arthurbergmz / customColor.dart
Created May 26, 2018 19:03
Custom Color for Dart
import 'dart:ui';
class CustomColor extends Color {
CustomColor(int color) : super(color);
static Color _fromHex (String hex) {
if (hex.startsWith("#")) hex = hex.substring(1);
int len = hex.length;
if (len == 8) hex = hex.substring(6) + hex.substring(0, 6);
@arthurbergmz
arthurbergmz / appendix_article.md
Created May 15, 2018 23:07
Gerenciamento de Tempo com base em Informação e Metodologias Ágeis

Gerenciamento de tempo com base em informação e metodologias ágeis

APÊNDICE

Empresa A

Atualmente, seu gerenciamento de tempo, em nível de Sprint, é beneficiado por Story Points, para se ter conhecimento de quanto será entregue a cada iteração.

Entrevistado da Empresa A: Em nível de projeto, ainda não é aplicada alguma gerência de tempo.

@arthurbergmz
arthurbergmz / javascript.json
Created December 27, 2017 00:24
StandardJS Snippets for Visual Studio Code
{
"function 1": {
"prefix": "func",
"body": [
"function ${1:name} ($2) {",
"\t$0",
"}"
],
"description": "ES6 import syntax"
},
@arthurbergmz
arthurbergmz / removeProperty.js
Created November 14, 2017 06:04
Property removal using the spread operator
function removeProperty (object, propertyName) {
const { [propertyName]: removed, ...response } = object
return response
}
@arthurbergmz
arthurbergmz / speechShyntesis.js
Created June 17, 2017 01:34
WebBrowser SpeechShyntesis - pt-BR
const synth = window.speechSynthesis
const speech = new SpeechSynthesisUtterance('Olá, mundo!')
speech.voice = synth.getVoices()[16] // Google PT-BR
speech.rate = 1
speech.pitch = 1
synth.speak(speech)