Skip to content

Instantly share code, notes, and snippets.

View wescleymatos's full-sized avatar
:octocat:
I'm ready!

Wescley Matos wescleymatos

:octocat:
I'm ready!
View GitHub Profile
@wescleymatos
wescleymatos / index.html
Created July 29, 2015 14:18 — forked from cauerego/example.html
jquery validate CPF, a brazilian document equivalent to social security - try: http://jsbin.com/gist/873308#preview ( originally at http://jsbin.com/agida4/16/edit )
<!DOCTYPE html>
<html>
<head>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script class="jsbin" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js" type="text/javascript"></script>
<script src="jquery.validate.cpf.js"></script>
<script type="text/javascript">
$(function () {
var $cpf = $("#id_cpf").attr("name");
var $params = {debug:false, rules:{}, messages:{}};
public static IEnumerable<IEnumerable<T>> Split<T>(this T[] array, int size)
{
for (var i = 0; i < (float)array.Length / size; i++)
{
yield return array.Skip(i * size).Take(size);
}
}
@wescleymatos
wescleymatos / CarController.cs
Created February 12, 2016 16:28 — forked from johnnyreilly/CarController.cs
Unit testing ModelState using Moq
using System.Web.Mvc;
namespace MyApp
{
public class CarController : Controller
{
//...
public ActionResult Edit(CarModel model)
{
@wescleymatos
wescleymatos / index.html
Created February 19, 2016 20:42 — forked from k33g/index.html
Vue.js + ES6
<div id="demo">
<h1>{{bob.fields.firstName}} {{bob.fields.lastName}}</h1>
</div>
<ul id="humans-list">
<li v-repeat="humans">
{{fields.firstName}} {{fields.lastName}}
</li>
</ul>
using Saegrn.Resource.Resources;
using Saegrn.Resource.Validation;
using System;
namespace Saegrn.Domain.Entities
{
public class Evento
{
#region Properties
public Guid Id { get; private set; }
@wescleymatos
wescleymatos / InscricaoService.cs
Created August 26, 2016 14:58
Exemplo onde se aplica o uso de um Builder?
namespace Saegrn.Domain.Services
{
public class InscricaoService : IInscricaoService
{
#region Properties
private IInscricaoRepository _inscricaoRepository;
private IUsuarioService _usuarioService;
private IOfertaService _ofertaService;
#endregion
@wescleymatos
wescleymatos / composicao.cs
Created September 13, 2016 19:16
dúvida composição
namespace Dominio {
public class Aluno
{
public Aluno( string nome, string matricula, string sexo, DateTime dataNascimento, string cpf, string corRaca, string email)
{
Nome = nome;
Matricula = matricula;
DataNascimento = dataNascimento;
Cpf = cpf;
public IQueryable<AlunoDto> BuscarTodosAlunoDtos()
{
var alunos = (
from al in _context.Alunos
join pe in _context.Pessoas on al.Id equals pe.Id
into alu
from alun in alu.DefaultIfEmpty()
join at in _context.AlunoTurmas on al.Id equals at.AlunoId into alt
from ats in alt.DefaultIfEmpty()
@wescleymatos
wescleymatos / send-ajax.js
Last active April 19, 2017 14:28
Send ajax jquery with some content-type
// multpart/data
$('form').on('submit', function (e) {
e.preventDefault();
var form = new FormData($(this)[0]);
$.ajax({
method: "POST",
url: URL,
data: form,
processData: false,
contentType: false,
@wescleymatos
wescleymatos / Gruntfile.js
Created May 31, 2017 02:44
Configuração do arquivo do grunt
module.exports = function(grunt) {
grunt.initConfig({
clean: {
temp: [
'public/js/app.js',
'public/js/libs.js'
],
all: [
'public/js/*.js'