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 / 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
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 / 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>
@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)
{
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 / 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:{}};
@wescleymatos
wescleymatos / custom_event.js
Last active August 29, 2015 14:15
Exemplo simples de Custom Event
var event = new CustomEvent('build', {
'detail': 'wescley'
});
document.addEventListener('build', function(e){
alert(e.detail);
var nome = e.detail + ' matos';
var ajaxEvent = new CustomEvent('ajax-return', {
'detail': nome
});
@wescleymatos
wescleymatos / toolbar.html
Last active August 29, 2015 14:06
snippet de um toolbar com twitter bootstrap
<nav class="navbar navbar" role="navigation">
<div class="container-fluid">
<div class="btn-toolbar" role="toolbar">
<div class="btn-group">
<a href="#" class="btn btn-danger">NEW</a>
</div>
<div class="btn-group">
<a href="#" class="btn btn-default">All</a>
<a href="#" class="btn btn-default">Friends</a>
<a href="#" class="btn btn-default">Family</a>
@wescleymatos
wescleymatos / sleep.js
Created August 4, 2014 18:50
Sleep do php com javascript
function sleep(milliseconds) {
var start = new Date().getTime();
for (var i = 0; i < 1e7; i++) {
if ((new Date().getTime() - start) > milliseconds) {
break;
}
}
}
@wescleymatos
wescleymatos / range_aleatorio.js
Last active August 29, 2015 14:04
Numeros aleatórios em um range com javascript
return Math.floor(Math.random() * (max - min + 1)) + min;