Skip to content

Instantly share code, notes, and snippets.

View vinicius-stutz's full-sized avatar
🐢
I may be slow to respond.

Vinícius Stutz vinicius-stutz

🐢
I may be slow to respond.
View GitHub Profile
@vinicius-stutz
vinicius-stutz / readme.md
Created May 2, 2018 17:15
Basic Git commands
@vinicius-stutz
vinicius-stutz / readme.md
Created April 28, 2018 23:30
Padrão de Nomenclaturas em CSS (pt-br)

Segundo Douglas Crockford, todos os padrões descritos em javascript.crockford.com/code.html são os mesmos utilizados em Java.

Nomeando arquivos

Os arquivos, tanto .js quanto .css devem ter seus nomes desta forma: nome-do-arquivos.css ou apenas nome-do-arquivos.css. Caso o arquivo faça referência a um framework ou biblioteca use por exemplo: bootstrap-nome-do-arquivos.css ou jquery-nome-do-arquivos.css. Se o arquivo estiver minificado use por exemplo nome-do-arquivos.min.css.

Id

É o identificador válido único de um elemento HTML que será usado no CSS para determinar qual elemento receberá o estilo. Também é usado no Javascript para manipulação do DOM. Ex.: nomeElemento ou NomeElemento.

@vinicius-stutz
vinicius-stutz / readme.md
Last active December 15, 2023 02:29
Padrão de Nomenclaturas em Javascript (pt-br)

Segundo Douglas Crockford, todos os padrões descritos em javascript.crockford.com/code.html são os mesmos utilizados em Java. Os padrões devem permanecer, apesar de não ser o mesmo adotado em outras linguagens, como o C#, por exemplo.

Nomeando arquivos

Os arquivos, tanto .js quanto .css devem ter seus nomes desta forma: nome-do-arquivos.css ou apenas nome-do-arquivos.js. Caso o arquivo faça referência a um framework ou biblioteca use por exemplo: bootstrap-nome-do-arquivos.js ou jquery-nome-do-arquivos.js. Se o arquivo estiver minificado use por exemplo nome-do-arquivos.min.js.

Funções

O que seriam os métodos no C# são as funções no Javascript. Mas diferente do C#, devem começar com letra minúscula e para cada palavra, a primeira letra deve ser maiúscula (lowerCamelCase).

@vinicius-stutz
vinicius-stutz / readme.md
Created April 28, 2018 23:21
Padrões de Nomenclatura em C# (pt-br)

Namespace

Por padrão toda biblioteca deve conter um nome padrão em seu namespace. Ex.: MinhaEmpresa.SeuNameSpace (padrão PascalCase).

Classes

As classes devem começar com letra maiúscula e para cada palavra, a primeira letra também deve ser maiúscula (padrão PascalCase).

C#

@vinicius-stutz
vinicius-stutz / readme.md
Created April 28, 2018 23:08
ASP.Net MVC Attribute Routing vs. ASP.Net MVC Convention Routing

What is Routing?

ASP.NET Routing is the ability to have URLs represent abstract actions rather than concrete, physical files.

In "traditional" websites, every URL represents a physical file, whether it is an HTML or ASPX page, or a script file, or some other content. If I see a URL of www.example.com/articles/post.aspx?id=65, I'm going to assume that that URL represents a folder called articles at the root of the site, and within that folder a page called post.aspx.

In MVC, no such physical folders and pages exist, and so the MVC architecture allows us to map routes to controllers and actions which may represent many kinds of results. Routing is a layer of abstraction on top of regular URLs that allows programmers greater control over what those URLs mean and how they are formatted.

"Hackable" URLs

@vinicius-stutz
vinicius-stutz / readme.md
Created April 26, 2018 02:48
Animated SVG Icons with Snap.svg

Please note that we are working with a modern JavaScript library for manipulating our SVGs. Older and non-supporting browsers will not be capable of all features.

The first thing we do is to create some SVG icons using an SVG editor like Inkscape. We used a size of 64×64 pixel for the icons.

For each icon we want a special animation to happen. For example, for the zoom icon we’ll want to scale up the plus path. We’ll define what will happen for each icon in our script.
We’ll add the icons dynamically to our page using Snap.svg and if SVG is not supported we’ll simply show a background image for the span elements that we use to wrap each graphic:

<section class="si-icons">
	<span class="si-icon si-icon-play" data-icon-name="play"></span>
	<span class="si-icon si-icon-monitor" data-icon-name="monitor"></span>
@vinicius-stutz
vinicius-stutz / default.css
Created April 26, 2018 02:43
CSS3 3D Buttons
/* Basic CSS Styling */
ul { list-style: none; }
a.button {
display: block;
float: left;
position: relative;
height: 25px;
width: 80px;
margin: 0 10px 18px 0;
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size:100%;font:inherit;vertical-align:baseline;margin:0;padding:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:none}table{border-collapse:collapse;border-spacing:0}
@vinicius-stutz
vinicius-stutz / readme.md
Created April 24, 2018 23:29
Progressive Web Apps

A Beginner's Guide To Progressive Web Apps

Characteristics Of A Progressive Web App

Before we jump into the code, it is important to understand that progressive web apps have the following characteristics:

  • Progressive. By definition, a progressive web app must work on any device and enhance progressively, taking advantage of any features available on the user’s device and browser.
  • Discoverable. Because a progressive web app is a website, it should be discoverable in search engines. This is a major advantage over native applications, which still lag behind websites in searchability.
  • Linkable. As another characteristic inherited from websites, a well-designed website should use the URI to indicate the current state of the application. This will enable the web app to retain or reload its state when the user bookmarks or shares the app’s URL.
  • Responsive. A progressive web app’
@vinicius-stutz
vinicius-stutz / readme.md
Created April 24, 2018 22:46
ASP.NET MVC Model Validation using Data Annotations

ASP.NET MVC Model Validation using Data Annotations

In ASP.NET MVC, there are several ways to validate the model data prior to saving the data into the data store.

  1. Validate the model data explicitly
  2. Implement the IValidateableObject interface
  3. Specify Data Annotations [Recommended]

Data Annotation is recommended because there are built-in Data Annotations in .NET Framework. You don’t have to implement your own validation logic, instead specifying the Validation Data Annotation that you need. The Data Annotations specified support both server-side & client-side validation. In case the built-in cannot fulfill your requirements, you can also implement your own Data Annotation.

Built-in Data Annotations