- x.x.x.1 = default gateway (assuming /24)
- 2-19 = network access devices (switches, etc.)
- 20-39 = server devices
- 40-59 = network peripherals (printers, etc.)
- 60-79 = reserved for special devices
- 80-99 = static addressed workstations
- 100-199 = standard DHCP pool of addresses
- 200-254 = VOIP devices (switch, adapters, etc.)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Place this code in the initialization section of your code. | |
// http://blogs.msdn.com/b/microsoft_press/archive/2010/02/03/jeffrey-richter-excerpt-2-from-clr-via-c-third-edition.aspx | |
AppDomain.CurrentDomain.AssemblyResolve += (sender, args) => { | |
String resourceName = "AssemblyLoadingAndReflection." + | |
new AssemblyName(args.Name).Name + ".dll"; | |
using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName)) { | |
Byte[] assemblyData = new Byte[stream.Length]; | |
stream.Read(assemblyData, 0, assemblyData.Length); | |
return Assembly.Load(assemblyData); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
".manifest", "application/manifest" | |
".xaml", "application/xaml+xml", | |
".application", "application/x-ms-application", | |
".deploy", "application/octet-stream" | |
".xbap", "application/x-ms-xbap" | |
".docm","application/vnd.ms-word.document.macroEnabled.12" | |
".docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document" | |
".dotm","application/vnd.ms-word.template.macroEnabled.12" | |
".dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Text; | |
public static class ExceptionExtensions | |
{ | |
public static string GetAllMessages(this Exception ex) | |
{ | |
var message = new StringBuilder(); | |
for (var e = ex; e != null; e = e.InnerException) | |
message.AppendLine(e.Message); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var list = Enumerable.Empty<object>() | |
.Select(r => new {A = 0, B = 0}) // prototype of anonymous type | |
.ToList(); | |
list.Add(new { A = 4, B = 5 }); // adding actual values | |
Console.Write(list[0].A); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
public static class GenericExtensions | |
{ | |
public static bool IsElementOf<T>(this T item, params T[] list) | |
{ | |
return Array.IndexOf(list, item) != -1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example of a currying methods | |
// https://medium.com/@kbrainwave/currying-in-javascript-ce6da2d324fe | |
var currier = function(fn) { | |
var args = Array.prototype.slice.call(arguments, 1); | |
return function() { | |
return fn.apply(this, args.concat( | |
Array.prototype.slice.call(arguments, 0))); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$test = array( | |
'c' => array( | |
'depends' => 'b' | |
), | |
'a' => array(), | |
'b' => array( | |
'depends' => 'd' | |
), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Title</title> | |
<!--[if lt IE 9]> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.js"></script> | |
<![endif]--> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Detecting data URLs | |
// data URI - MDN https://developer.mozilla.org/en-US/docs/data_URIs | |
// The "data" URL scheme: http://tools.ietf.org/html/rfc2397 | |
// Valid URL Characters: http://tools.ietf.org/html/rfc2396#section2 | |
function isDataURL(s) { | |
return isDataURL.regex.test(s); | |
} | |
isDataURI.regex = /^\s*data:([a-z]+\/[a-z0-9\-]+(;[a-z\-]+\=[a-z\-]+)?)?(;base64)?,[a-z0-9\!\$\&\'\,\(\)\*\+\,\;\=\-\.\_\~\:\@\/\?\%\s]*\s*$/i; |