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
Last active December 29, 2015 13:31
CSS3: Navicon Transformicons
@vinicius-stutz
vinicius-stutz / README.md
Created December 30, 2015 13:41
Google Chrome Favicons For Bookmarklets

Google Chrome Favicons For Bookmarklets

  1. Open the Bookmark Manager and export your bookmarks;
  2. Open the exported html file in your favorite editor and look for the bookmarklet you want a favicon applied to;
  3. Convert the 16x16 px (or greater) favicon you want to use into the BASE64 format (I used Base64 Image Encoder);
  4. Now you can add the favicon via adding the ICON="data:image/insert-your-base64-image-code-here" attribute in the link;
  5. Save the file and import it in the bookmark manager.

Done! If the favicon doesn’t show up, try clicking on the bookmarklet. Afterwards the changes should stick and you can delete the imported bookmarks folder. If you have sync activated the favicons on your bookmarklets will also show up on your other PC, Mac, smartphone etc.

@vinicius-stutz
vinicius-stutz / README.md
Last active March 16, 2016 18:51
Query string via JavaScript

How to make query string in JavaScript

This is an equivalent function to the method of C# Request.QueryString, in order to return the URL parameters derived

@vinicius-stutz
vinicius-stutz / sample.html
Created June 2, 2016 20:09
Encode String with Base64 in Javascript
<!-- Add some tags here, head, title etc and your references -->
<p>
<label>Codificada:</label>
<span id='1'></span>
</p>
<p>
<label>Limpa:</label>
<span id='2'></span>
</p>
@vinicius-stutz
vinicius-stutz / sample.js
Created July 11, 2016 19:24
Remove jQuery Plugin Instances
var $element = $('div#test');
// You can examine all of the events attached to an element
$._data($element.get(0), 'events');
// Remove namespaced events added using .on()
$element.off('pluginNamespace');
// Remove namespaced events added using .bind()
$element.unbind('.pluginNamespace');
@vinicius-stutz
vinicius-stutz / dbms_app_info_set_module.sql
Last active November 17, 2016 18:19
How to write an information in the V$SESSION table using the current user session in Oracle Database
/*
* HOW TO WRITE AN INFORMATION IN THE V$SESSION TABLE USING THE
* CURRENT USER SESSION IN ORACLE DATABASE.
*/
-- EXAMPLE OF RECORDING INFORMATION
BEGIN
DBMS_APPLICATION_INFO.SET_MODULE('ANY_ID', 'YOUR INFO HERE');
END;
@vinicius-stutz
vinicius-stutz / parte01.md
Created April 24, 2018 03:37
Mapeamento com Entity Framework Code First (Fluent Api)

Qual a diferença entre Data Annotations e Fluent Api?

Quando usado o mapeamento por Data Annotations, as propriedades das entidades POCO (Plain Old CLR Object) são decoradas com atributos, fazendo necessário referência externa, além da “sujeira” dos metadados.

public int ClienteId {get; set;}
[MaxLength(150), Required]
public string Nome { get; set; }

No Fluent Api usamos métodos encadeados fora das entidades, as mesmas permanecem “limpas”, porém precisamos escrever mais código.

@vinicius-stutz
vinicius-stutz / part1.md
Created April 24, 2018 22:38
Using DataTables with C# and Web API

Using DataTables with Web API Part 1: Making a simple GET Request

I've faced this need several times over the years:

So, we've got our dashboard, and we need to show customer/user/whatever data in a table so we can search, sort, filter, all that good stuff...

Sound familiar? Well, there are a few ways we could approach this. To start with, we could put it all together by hand. Creating the table structure and binding each individual row from a data source. But that's loads of work! What we need is some kind of helper or plugin to make our lives easier. Something that will turn our ordinary table into a powerhouse of searchable goodness.

Enter DataTables...

@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

@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’