Skip to content

Instantly share code, notes, and snippets.

View jrgcubano's full-sized avatar

Jorge Rodríguez Galán jrgcubano

View GitHub Profile
@jrgcubano
jrgcubano / SetAssemblyInfoToVersion.ps1
Created July 5, 2016 12:45 — forked from derekgates/SetAssemblyInfoToVersion.ps1
Changes version information in AssemblyInfo.cs files recursively from a given path. I use this with TeamCity to control the version number as the built in Build Feature runs before my psake script can obtain the version (clearing out the version!).
# SetAssemblyVersion.ps1
#
# http://www.luisrocha.net/2009/11/setting-assembly-version-with-windows.html
# http://blogs.msdn.com/b/dotnetinterop/archive/2008/04/21/powershell-script-to-batch-update-assemblyinfo-cs-with-new-version.aspx
# http://jake.murzy.com/post/3099699807/how-to-update-assembly-version-numbers-with-teamcity
# https://github.com/ferventcoder/this.Log/blob/master/build.ps1#L6-L19
Param(
[string]$path=$pwd
)
@jrgcubano
jrgcubano / TodoItem.xaml
Created July 22, 2016 12:12 — forked from conceptdev/TodoItem.xaml
TranslateExtension for Xamarin.Forms Xaml. Note: the xmlns declaration in the <ContentPage> tag
<?xml version="1.0" encoding="UTF-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i18n="clr-namespace:QuickTodo;assembly=QuickTodo"
x:Class="TodoXaml.TodoItemXaml">
<ContentPage.Content>
<StackLayout VerticalOptions="StartAndExpand">
<Label Text="{i18n:Translate Name}" />
@jrgcubano
jrgcubano / web.config.xml
Created August 2, 2016 09:22 — forked from marcbarry/machine.config
complete security hardening web.config template
<system.web>
<!-- -->
<trace enabled="false" />
<!-- -->
<deployment retail="true"/>
<!-- -->
@jrgcubano
jrgcubano / MonitorEndpoints.ps1
Created August 5, 2016 11:59 — forked from stefanprodan/MonitorEndpoints.ps1
Calling ASP.NET Web API endpoints at regular intervals can be easily done using Windows Task Scheduler and PowerShell’s Invoke-RestMethod. The following script makes a GET call for each supplied endpoint, if a call fails then the endpoint’s URL and the error details are sent to Windows Application Event Log.
#############################################
##
## Monitor ASP.NET WebAPI Enpoints
## Author: Stefan Prodan
## Date : 7 Apr 2014
## Company: VeriTech.io
#############################################
#Base url
$urlPrefix = "http://localhost/MyApp.Server/";
@jrgcubano
jrgcubano / BaseController.cs
Created August 7, 2016 23:54 — forked from mhinze/BaseController.cs
BaseController.cs with Async
using System.Threading.Tasks;
using System.Web.Mvc;
using JetBrains.Annotations;
using ShortBus;
public abstract class BaseController : Controller
{
public IMediator Mediator { get; set; }
protected Response<TResult> Query<TResult>(IQuery<TResult> query)
@jrgcubano
jrgcubano / AsyncMediatorPipeline.cs
Created August 8, 2016 09:22
AsyncMediatorPipeline and Autofac Registration
public class AsyncMediatorPipeline<TRequest, TResponse> : IAsyncRequestHandler<TRequest, TResponse> where TRequest : IAsyncRequest<TResponse>
{
private readonly IAsyncRequestHandler<TRequest, TResponse> inner;
private readonly IAsyncPreRequestHandler<TRequest>[] preRequestHandlers;
private readonly IAsyncPostRequestHandler<TRequest, TResponse>[] postRequestHandlers;
public AsyncMediatorPipeline(IAsyncRequestHandler<TRequest, TResponse> inner, IAsyncPreRequestHandler<TRequest>[] preRequestHandlers, IAsyncPostRequestHandler<TRequest, TResponse>[] postRequestHandlers)
{
this.inner = inner;
using Autofac;
using Autofac.Core;
using Cloudinator.Portal.WebApi.Infrastructure;
using Cloudinator.Portal.WebApi.Infrastructure.Handlers;
using FluentValidation;
using MediatR;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
@jrgcubano
jrgcubano / 01.ApiResponseSample_Normal.js
Created August 18, 2016 08:31 — forked from wellwind/01.ApiResponseSample_Normal.js
ASP.NET WebApi自訂回傳訊息Demo
{
"StatusCode": 200,
"Result": {
Name = "Wellwind",
Age = 30
},
"Error": null
}
@jrgcubano
jrgcubano / credit_card.rb
Created August 25, 2016 09:18
Faker::CreditCard creates fake credit card numbers and PhoneNumber::ddd creates fake ddds (brazilian) for testing
# Complement to Faker gem to create credit card number
# Usage:
# > Faker::CreditCard.visa
# => "4916287009378994"
#
# Card support:
# visa, master, amex, discover, diners, en_route, jcb, voyager
# Inspired by: http://www.darkcoding.net/credit-card/luhn-formula/
@jrgcubano
jrgcubano / LineEntry.cs
Created August 29, 2016 13:44 — forked from davidtavarez/LineEntry.cs
Xamarin.Forms Entry just with bottom border.
using Xamarin.Forms;
namespace YOUTNAMESPACE
{
public class LineEntry : Entry
{
public static readonly BindableProperty BorderColorProperty =
BindableProperty.Create<LineEntry, Color> (p => p.BorderColor, Color.Black);
public Color BorderColor {