Javascript | How to check sessionStorage support

var IS_SESSION_STORAGE_SUPPORTED; try { if (window.sessionStorage) { IS_SESSION_STORAGE_SUPPORTED = true; } else { IS_SESSION_STORAGE_SUPPORTED = false; } } catch (e) { IS_SESSION_STORAGE_SUPPORTED = false; } if (console) console.log(IS_SESSION_STORAGE_SUPPORTED);

ASP.NET Core | Making a request synchronously

using (var netClient = new System.Net.Http.HttpClient()) { var response = netClient.GetAsync(“https://example.com”).Result; if (response.IsSuccessStatusCode) { var responseContent = response.Content; string responseAsString = responseContent.ReadAsStringAsync().Result; Console.WriteLine(responseAsString); } }

PHP | List all folders in the mailbox

$mbox = imap_open(“{mail.example.com:143/novalidate-cert}”, “foo@example.com”, “password”) or die(“can’t connect: ” . imap_last_error()); $folders = imap_list($mbox, “{mail.example.com:143/novalidate-cert}”, “*”); if ($folders === false) { echo “Failed to list folders in mailbox”; } else { print_r($folders); } imap_close($mbox);

C# | Cast an int to enum

using System; public class Program { public static void Main() { var e0 = (Food)Enum.ToObject(typeof(Food), 0); Console.WriteLine(e0); // or simply var e2 = (Food)2; Console.WriteLine(e2); } public enum Food { Pizza, Pasta, Tofu } }

HTML Minify v 1.3.2 released!

We added three new options to the web tool and API: – Remove quotes around attributes when possible – Strip HTML comments – Remove all attributes with whitespace-only values Try it now! dotmaui.com/htmlminify api.dotmaui.com/htmlmin