Skip to content

Instantly share code, notes, and snippets.

View fnalin's full-sized avatar
🤓

Fabiano Nalin fnalin

🤓
View GitHub Profile
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
@fnalin
fnalin / drop-tables.sql
Created August 16, 2017 18:32 — forked from richardkundl/drop-tables.sql
Drop all tables in a SQL Server database (Azure Friendly!)
-- original source: http://edspencer.me.uk/2013/02/25/drop-all-tables-in-a-sql-server-database-azure-friendly/
-- drop all constraint
while(exists(select 1 from INFORMATION_SCHEMA.TABLE_CONSTRAINTS where CONSTRAINT_TYPE='FOREIGN KEY'))
begin
declare @sql1 nvarchar(2000)
SELECT TOP 1 @sql1=('ALTER TABLE ' + TABLE_SCHEMA + '.[' + TABLE_NAME
+ '] DROP CONSTRAINT [' + CONSTRAINT_NAME + ']')
FROM information_schema.table_constraints
WHERE CONSTRAINT_TYPE = 'FOREIGN KEY'
@fnalin
fnalin / _jQueryMaskPlugin-Demo.html
Last active August 29, 2015 14:03
Demo c/ jQuery Mask Plugin
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<title>Demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="http://ajax.aspnetcdn.com/ajax/modernizr/modernizr-2.7.2.js"></script>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" />
<style>
body{
@fnalin
fnalin / _div-container.html
Last active August 29, 2015 14:03
Div editável dinamica
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Demo - div-container-plus</title>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" />
<link href="div-container-plus.css" rel="stylesheet" />
</head>
<body>
@fnalin
fnalin / TesteLike.sql
Last active August 29, 2015 14:02
Pesquisa simples através do like no SQL buscando com caracteres coringas.
USE MASTER
GO
IF(SELECT Count(name) FROM sys.databases WHERE name = 'TESTELike')=1
BEGIN
ALTER DATABASE TESTELike SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
DROP DATABASE TESTELike;
END
GO
CREATE DATABASE TESTELike
GO
@fnalin
fnalin / datepicker_pt-br.js
Created May 26, 2014 17:39
Add Regional DatePicker pt-br
$.datepicker.regional['pt-BR'] = {
closeText: 'Fechar',
prevText: '&#x3c;Anterior',
nextText: 'Pr&oacute;ximo&#x3e;',
currentText: 'Hoje',
monthNames: ['Janeiro', 'Fevereiro', 'Mar&ccedil;o', 'Abril', 'Maio', 'Junho',
'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
monthNamesShort: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun',
'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
dayNames: ['Domingo', 'Segunda-feira', 'Ter&ccedil;a-feira', 'Quarta-feira', 'Quinta-feira', 'Sexta-feira', 'S&aacute;bado'],
@fnalin
fnalin / methods_pt.js
Created May 26, 2014 17:33
Extensão do jQuery-Validate
/*
* Localized default methods for the jQuery validation plugin.
* Locale: PT_BR
*/
jQuery.extend(jQuery.validator.methods, {
date: function (value, element) {
return this.optional(element) || /^\d\d?\/\d\d?\/\d\d\d?\d?$/.test(value);
},
number: function (value, element) {
return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:\.\d{3})+)(?:,\d+)?$/.test(value);
@fnalin
fnalin / DemoPesquisarComOuSemAcento.cs
Last active August 29, 2015 14:01
Demonstração de como pesquisar nomes com acentos
class Program
{
static void Main(string[] args)
{
var nomes = new string[] { "Luis", "Luís","Lüis" };
var nome = nomes.Where(d => d.RemoverAcentosExtension() == "Luis").ToList();
nome.ForEach(x => Console.WriteLine(x + "\n"));
}
@fnalin
fnalin / parseDataBrUSA.js
Created May 6, 2014 12:06
Função js para converter data no formato dd/mm/yyyy para mm/dd/yyyy
var ParseDataBrUSA = function (data) {
if (!(data.indexOf("/") > 0 || data.indexOf("-") > 0))
return "";
var _data = data.split(data.indexOf("-") > 0 ? "-" : "/");
var d1 = _data[0];
var d2 = _data[1];
var d3 = _data[2];
return d2 + "/" + d1 + "/" + d3;
};
@fnalin
fnalin / EnviarJson.cs
Last active August 29, 2015 14:00
Demo Json Asp.Net MVC
//Controller
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
[HttpPost]
public bool PostJson(ModeloJson dados)