Skip to content

Instantly share code, notes, and snippets.

View kidchenko's full-sized avatar

Jose Barbosa kidchenko

View GitHub Profile
@kidchenko
kidchenko / commands-nuget.txt
Created November 28, 2013 21:43
Command NuGet
Update all packages in a single project
Update-Package -Project MvcApplication1
---------------------------------------------
Update a package in all projects
Update-Package PackageId
---------------------------------------------
Update all packages in all projects
@kidchenko
kidchenko / ferramentas.txt
Last active December 30, 2015 01:18
Ferramentas
https://github.com/loadfive/knwl.js
http://codigofonte.uol.com.br/artigos/30-plugins-de-jquery-e-ajax-para-autocomplete ////// http://xilinus.com/jquery-addresspicker/demos/index.html -- autocomplete para endereços com googleMaps
http://postmon.com.br/ - buscar endereço pelo cep com código do IBGE
http://evenancio.wordpress.com/2011/09/29/consulta-de-cep-gratuita-com-o-google-maps-api/ - buscar cep ou achar o cep através do endereço via WCF com .net
helvética - fonte mais usada no mundo
http://www.myfonts.com/WhatTheFont/
@kidchenko
kidchenko / Produto.cs
Created February 13, 2014 14:36
Exemplo de relacionamentos com EF
//1 : 1
public class Produto
{
[Key]
public int Id {get;set;}
[ForeignKey("Categoria")]
public int CategoriaId {get;set;}
/*Outros atributos*/
$.ajaxSettings.traditional = true; // <-- Important
$('#btn').click(function () {
var array = [];
var url = '/Controller/Action';
$.post(url, { array : array });
});
});
@kidchenko
kidchenko / HtmlHelpers.cs
Created February 19, 2014 20:23
HtmlHelper para o tipo do produto segundo as tabelas utilizadas no SPED
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Web.Mvc;
using System.Web.Mvc.Html;
namespace HtmlHelpers
{
public static class HtmlHelperExtensions
{
@kidchenko
kidchenko / ErrorMessages.resx.xml
Created March 6, 2014 17:37
Griffin configuration.
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
@kidchenko
kidchenko / web.config
Created March 17, 2014 20:48
Show message error in realease. Asp net mvc
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
@kidchenko
kidchenko / RemoveNoUTF8Char.cs
Last active September 1, 2020 04:03
Remove non UTF-8 characters
if (string.IsNullOrEmpty(input))
return "";
else
{
var bytes = System.Text.Encoding.GetEncoding("iso-8859-8").GetBytes(input);
return System.Text.Encoding.UTF8.GetString(bytes);
}
Marcador: Significado
TODO: Elementos ainda não implementados
FIXME: Código que sabidamente apresenta problemas
HACK: Solução admitante deselegante para um problema
XXX: Perigo! Há um grande problema aqui
@kidchenko
kidchenko / DecimalModelBinder.cs
Created June 27, 2014 18:14
Make decimal work in asp net mvc
public class DecimalModelBinder : IModelBinder
{
public object BindModel(ControllerContext controllerContext,
ModelBindingContext bindingContext)
{
ValueProviderResult valueResult = bindingContext.ValueProvider
.GetValue(bindingContext.ModelName);
ModelState modelState = new ModelState { Value = valueResult };
object actualValue = null;
try