Skip to content

Instantly share code, notes, and snippets.

View diegobarbosa's full-sized avatar

Diego Barbosa diegobarbosa

  • São Paulo, SP, Brasil
View GitHub Profile
youtube-dl -x --audio-format mp3
youtube-dl -x --audio-format mp3 --playlist-start 1 --playlist-end 5
https://www.tecmint.com/download-mp3-track-from-youtube-video-using-youtube-dl/
@diegobarbosa
diegobarbosa / SimpleHTTPServer.cs
Created September 21, 2016 13:57 — forked from aksakalli/SimpleHTTPServer.cs
SimpleHTTPServer in C#
// MIT License - Copyright (c) 2016 Can Güney Aksakalli
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.Net;
using System.IO;
using System.Threading;
@diegobarbosa
diegobarbosa / gist:d35a2cde80fca9994faec50e35946f9e
Created April 25, 2016 18:40
Debug a Unit Test in Visual Studio
System.Diagnostics.Debugger.Launch();
@diegobarbosa
diegobarbosa / bindingJSON
Last active September 3, 2015 03:34 — forked from code-for-coffee/bindingJSON
ASP.NET MVC: Intro to MVC Binding JSON objects to Models
ASP.NET MVC: Intro to MVC using Binding JSON objects to Models
This post is designed to assist in jump-starting your MVC (model-view-control) project binding JSON to models (using Ajax posts). I feel that this is a vital skill to any journeyman ASP.NET MVC developer. Before we start note that all examples using Xamarin (Mono 3.2.0) - this should be opened in Visual Studio 2010+.
If you're new to MVC, here is a brief explanation. This design pattern is designed to keep your code into specific parts dedicated for specific usage. Models are designed to represent your data objects. The controller works with/manipulates models (backend, server side code). It then generates a View (rendered HTML) that is presented to the user on their web browser. The Model and Controller are written in C# for this project. The View is rendered in pure HTML with Javascript.
Create a new MVC project and call it "bindingJSON" (using the standard, no authentication). Now, inspect the object you need to model. Using an object orien
@diegobarbosa
diegobarbosa / gist:36152fdf4180ef295aff
Created August 11, 2015 02:30
Resetar coluna Identity
DBCC CHECKIDENT('Usuario', RESEED, 100)
Nome da tabela, comando, número base: O próximo número gerado será 101
alias open-my-project='cd "full/path/to/MySolutionFolder/" && start MySolution.sln /D .'
#example:
#alias open-mp='cd "C:/Users/max.nunes/Projects/myproject/" && start myproject.sln /D .'
@diegobarbosa
diegobarbosa / gist:3d33be30357fa7d44237
Last active August 29, 2015 14:15 — forked from SzymonPobiega/gist:5220595
DDD/CQRS/ES/Architecture videos

If you have two days to learn the very basics of modelling, Domain-Driven Design, CQRS and Event Sourcing, here's what you should do:

In the evenings read the [Domain-Driven Design Quickly Minibook]{http://www.infoq.com/minibooks/domain-driven-design-quickly}. During the day watch following great videos (in this order):

  1. Eric Evans' [What I've learned about DDD since the book]{http://www.infoq.com/presentations/ddd-eric-evans}
  2. Eric Evans' [Strategic Design - Responsibility Traps]{http://www.infoq.com/presentations/design-strategic-eric-evans}
  3. Udi Dahan's [Avoid a Failed SOA: Business & Autonomous Components to the Rescue]{http://www.infoq.com/presentations/SOA-Business-Autonomous-Components}
  4. Udi Dahan's [Command-Query Responsibility Segregation]{http://www.infoq.com/presentations/Command-Query-Responsibility-Segregation}
  5. Greg Young's [Unshackle Your Domain]{http://www.infoq.com/presentations/greg-young-unshackle-qcon08}
  6. Eric Evans' [Acknowledging CAP at the Root -- in the Domain Model]{ht
@diegobarbosa
diegobarbosa / gist:fafbf337ea5649569d8b
Created October 29, 2014 20:14 — forked from alessandroleite/gist:4088216
Leituras Recomendadas de Orientação a Objetos
  1. The Art of Readable Code - http://www.amazon.com/The-Readable-Code-Dustin Boswell/dp/0596802293/ ; Edição em Português - A Arte de Escrever Programas Legíveis - (Capítulo de Exemplo: http://goo.gl/cQSTr, sumário: http://goo.gl/o1FBD).

  2. Growing Object-Oriented Software, Guided by Tests - http://www.amazon.com/Growing-Object-Oriented-Software-Guided-Tests/dp/0321503627/ - Um ótimo livro para aprender corretamente Orientação a Objetos juntamente com a prática de testes. Este livro mais o do Meilir Pages-Jones (título abaixo, 3) são leituras obrigatórias para todo desenvolvedor O.O. Por exemplo, muitos livros e cursos de O.O só retratam como características do paradigma, encapsulamento, polimorfismo, herança e abstração e esquecem de mencionar outras, também importantes, como covariância;

  3. Fundamentals of Object-Oriented Design in UML - http://www.amazon.com/Fundamentals-Object-Oriented-Design-Meilir-Page-Jones/dp/020169946X/

  4. Clean Code: A Handbook of Agile Software Craftsmanship - http://www.amazon

@diegobarbosa
diegobarbosa / gist:e2e6df2f834211c7ddc3
Created April 29, 2014 20:27
How to make an auto height DIV wrap around floating content
http://webdev-il.blogspot.com.br/2011/03/how-to-make-auto-height-div-wrap-around.html
When you design web pages with CSS sooner or later you'll run into this problem - you've got a nice auto height div container with some floating elements inside BUT the auto container doesn't expand to wrap around those floating elements inside!
Example:
<div id="wrapper"><!-- auto height -->
<div id="col1"></div><!-- floating -->
<div id="col2"></div><!-- floating -->
</div>
@diegobarbosa
diegobarbosa / gist:5301822
Created April 3, 2013 14:44
A custom DataBinding for DateTime with culture in Asp.Net Mvc. Source: http://stackoverflow.com/questions/2356601/custom-datetime-model-binder-in-asp-net-mvc
public class DateTimeBinder : IModelBinder
{
public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
{
var value = bindingContext.ValueProvider.GetValue(bindingContext.ModelName);
var date = value.ConvertTo(typeof(DateTime), CultureInfo.CurrentCulture);
return date;