Skip to content

Instantly share code, notes, and snippets.

View mahizsas's full-sized avatar

MAHIZ mahizsas

View GitHub Profile
@mahizsas
mahizsas / bootstrap-validation.js
Created May 21, 2013 05:28 — forked from ijason/bootstrap-validation.js
Validatin sito Boostrap
$(function () {
$('span.field-validation-valid, span.field-validation-error').each(function () {
$(this).addClass('help-inline');
});
$('.validation-summary-errors').each(function () {
$(this).addClass('alert');
$(this).addClass('alert-error');
$(this).addClass('alert-block');
});
namespace Radar.Common.WebServer.Api.Controllers
{
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;
public class AutoLocalizingRoute : Route
{
public AutoLocalizingRoute(string url, object defaults, object constraints)
: base(url, new RouteValueDictionary(defaults), new RouteValueDictionary(constraints), new MvcRouteHandler()) { }
public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values)
{
// only set the culture if it's not present in the values dictionary yet
// this check ensures that we can link to a specific language when we need to (fe: when picking your language)
if (!values.ContainsKey("language"))
public abstract class CircuitBreakerState
{
protected readonly CircuitBreaker circuitBreaker;
protected CircuitBreakerState(CircuitBreaker circuitBreaker)
{
this.circuitBreaker = circuitBreaker;
}
public virtual void ProtectedCodeIsAboutToBeCalled() { }
@mahizsas
mahizsas / Id.cs
Created May 6, 2013 19:46 — forked from jmhdez/Id.cs
public struct Id<T>
{
public readonly int Value;
public Id(int value)
{
this.value = value;
}
public static implicit operator Id<T>(int value)
@mahizsas
mahizsas / gist:5497549
Created May 1, 2013 19:07 — forked from Mithrandir0x/gist:3639232
How to use Service, Factory, Provider
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
@mahizsas
mahizsas / DependencyInjection.cs
Created April 19, 2013 13:04 — forked from iamkoch/DependencyInjection.cs
How to Inject deps in controllers with Castle
using System;
using System.IO;
using System.Reflection;
using System.Web;
using System.Web.Mvc;
using Castle.MicroKernel.Registration;
using Castle.Windsor;
using Castle.Windsor.Installer;
using WednesdayFootball.Factory;
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
// Register an Action selector that can include template parameters in the name
config.Services.Replace(typeof(IHttpActionSelector), new ODataActionSelector());
var model = GetEdmModel();
var odataFormatter = new ODataMediaTypeFormatter(model);
@mahizsas
mahizsas / validtimes.cs
Created April 4, 2013 06:49 — forked from MisterJames/Build a list of valid times
Build a list of valid times
List<string> times = new List<string>();
Enumerable.Range(0, 24).ToList()
.ForEach(hour => Enumerable.Range(0, 2).ToList()
.Select(x => string.Format("{0}:{1:00}", hour, x * 30))
.ToList()
.ForEach(timeslot=>times.Add(timeslot)));
@ECHO OFF
SETLOCAL
SET VERSION=%1
SET NUGET=buildsupport\nuget.exe
FOR %%G IN (packaging\nuget\*.nuspec) DO (
%NUGET% pack %%G -Version %VERSION% -Symbols -o artifacts
)