- 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
<?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
// 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
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
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.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
".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
// 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
<?php | |
/* Directories that contain classes */ | |
$classesDir = array ( | |
ROOT_DIR.'classes/', | |
ROOT_DIR.'firephp/', | |
ROOT_DIR.'includes/' | |
); | |
function __autoload($class_name) { | |
global $classesDir; |
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 | |
/** | |
* Smart Tidy/Gzip Output Buffer | |
* Compress HTML output to a single line, then attempt gzip compression. | |
* @param string $buffer | |
* @param int $mode | |
* @return string|false | |
*/ | |
function ob_minify($buffer, $mode) { |