Skip to content

Instantly share code, notes, and snippets.

View lucamilan's full-sized avatar
🏠
Working from home

Luca Milan lucamilan

🏠
Working from home
View GitHub Profile
@lucamilan
lucamilan / bootstrap-modal-responsive-fix.js
Created August 12, 2012 09:33
Twitter Bootstrap modal responsive fix by @niftylettuce
// # Twitter Bootstrap modal responsive fix by @niftylettuce
// * resolves #407, #1017, #1339, #2130, #3361, #3362, #4283
// <https://github.com/twitter/bootstrap/issues/2130>
// * built-in support for fullscreen Bootstrap Image Gallery
// <https://github.com/blueimp/Bootstrap-Image-Gallery>
// **NOTE:** If you are using .modal-fullscreen, you will need
// to add the following CSS to `bootstrap-image-gallery.css`:
//
// @media (max-width: 480px) {
@lucamilan
lucamilan / blog_sharing_validation.md
Created August 29, 2012 19:41 — forked from liammclennan/blog_sharing_validation.md
Sharing client / server validation

Client-side web applications (SPAs whatever) must perform client-side validation to achieve the required responsiveness. But the client is not a secure environment, so client-side validation is a convenience, not to be trusted. Validation has to be performed server-side to ensure security and data correctness.

Traditional Solutions to the Client / Server Validation Problem

Shared Metadata

Asp.net mvc exports validation metadata from server-side models and embeds it into form markup. This process is distributed throughout mvc's form helpers. Each time a form element is generated the framework adds data- attributes to that element that describe that element's validation.

On the client-side a script runs that reads the validation metadata from the data- validation attributes and translates that metadata into a format suited to a client-side validation framework (asp.net mvc uses jquery.validation).

@lucamilan
lucamilan / jquery.fisheyegrid.js
Created September 13, 2012 10:46 — forked from a-laughlin/jquery.fisheyegrid.js
Fisheye Grid UI Design Pattern in jQuery
/*!
* jQuery Fisheye Grid version 0.01
* Copyright 2011, Adam Laughlin
* http://a-laughlin.com
* Licensed under MIT & GPL version 2
* http://static.a-laughlin.com/mit_license.txt
* http://static.a-laughlin.com/gpl_license.txt
*/
/*
@lucamilan
lucamilan / gist:3780468
Created September 25, 2012 07:35 — forked from SlyNet/gist:2036300
Making asp.net validation work with twitter bootstrap
$.validator.setDefaults({
highlight: function (element) {
$(element).closest(".control-group").addClass("error");
},
unhighlight: function (element) {
$(element).closest(".control-group").removeClass("error");
}
});
$(function () {
$('span.field-validation-valid, span.field-validation-error').each(function () {
<configuration>
//......
//......
<system.web>
<httpHandlers>
<add path="*.js" verb="GET,HEAD" type="System.Web.StaticFileHandler" />
<add path="*.css" verb="GET,HEAD" type="System.Web.StaticFileHandler" />
<add path="*" verb="*.cshtml" type="System.Web.HttpNotFoundHandler"/>
public class RavenDBRegistry:Registry
{
public RavenDBRegistry()
{
var documentStore = new EmbeddableDocumentStore
{
RunInMemory = true
}.Initialize();
For<IDocumentSession>().Use(() => documentStore.OpenSession());
@lucamilan
lucamilan / gist:efbfe3746baa624e9a22
Last active August 29, 2015 14:25 — forked from alex-groshev/gist:1e047950cb9b2d12c212
Invoking multiple handlers periodically from Topshelf Windows Service (using System.Threading.Timer)
using System;
using System.Collections.Generic;
using System.Threading;
using Topshelf;
namespace ConsoleApplication
{
public interface IProcess
{
void Perform();
@lucamilan
lucamilan / gist:f5b85d33716e5061e212
Last active August 29, 2015 14:25 — forked from philbarresi/gist:55918919f495ab92b3f6
AngularJS Connection Provider for SignalR
// We start our app
var myApp = angular.module("myApp", []);
myApp.provider('connection', function Connection() {
var connection = $.connection,
reconnectDelay = 1500,
maxReconnectDelay = 60000;
// allows you to set logging on before the connection runs
this.showLogging = function () {
@lucamilan
lucamilan / gist:f7e4e2a791f97c686937
Created November 17, 2015 19:12 — forked from amagdas/gist:6078361
Synchronized Queue, blocks on Enqueue if the maximum size is reached.
using System.Collections.Generic;
using System.Threading;
namespace Utilities
{
/// <summary>
/// Synchronized queue which blocks on dequeue.
/// </summary>
/// <typeparam name="T"></typeparam>
public sealed class SynchronizedQueue<T>
@lucamilan
lucamilan / readme.md
Created December 31, 2015 09:03 — forked from elijahmanor/readme.md
Front-End Web Dev Interview Preparation

High Level Questions

  • Can you detail your common development workflow from beginning to end?
  • What types of things do you consider when trying to build a cross-browser web solution?
  • What do you do when you don't know how to do something?
  • How do you continue to learn and sharpen your skills in light of how quickly things change?
  • What is an exciting project that you've worked on recently?

Low Level Questions