Skip to content

Instantly share code, notes, and snippets.

@EmeraldCoder
EmeraldCoder / JSONHelper.cs
Created December 25, 2014 14:56
C# MVC JSON Helpers
using System.Web.Mvc;
using System.Web.Script.Serialization;
namespace Web.Helpers
{
public static class ExtensionMethods
{
public static MvcHtmlString ToJson(this HtmlHelper html, object obj)
{
JavaScriptSerializer serializer = new JavaScriptSerializer();
@EmeraldCoder
EmeraldCoder / REG_FolderContextMenu_MakeAlwaysVisible_OpenWindowHere
Created May 9, 2014 02:59
Script to make option "Open command window here" in folder context menu always visible without using MAJ key
Windows Registry Editor Version 5.00
; Philippe Ouellet
; May 5, 2014
; Script to make option "Open command window here" in folder context menu always visible without using MAJ key
[HKEY_CLASSES_ROOT\Drive\shell\cmd]
"Extended"=-
[HKEY_CLASSES_ROOT\Directory\shell\cmd]
@EmeraldCoder
EmeraldCoder / REG_FolderContextMenu_Install_OpenPowerShellHere.reg
Last active August 29, 2015 14:01
Script to add option "Open PowerShell window here" in folder context menu
Windows Registry Editor Version 5.00
; Philippe Ouellet
; May 5, 2014
; Script to add option "Open PowerShell window here" in folder context menu
[HKEY_CLASSES_ROOT\Drive\shell\PowerShell]
@="Open PowerShell window Here"
[HKEY_CLASSES_ROOT\Drive\shell\PowerShell\command]
@="powershell.exe -NoExit -Command Set-Location -LiteralPath '%1'"
@EmeraldCoder
EmeraldCoder / explode trim
Created July 15, 2013 18:25
a simple one line method to explode & trim whitespaces from the exploded elements
array_map('trim',explode(",",$str));
@EmeraldCoder
EmeraldCoder / gist:5978944
Created July 11, 2013 20:28
Search a value in a array using a case insensitive check
/**
* Search a value in a array using a case insensitive check
* similar to array_search() but case insensitive
*
* @param $search
* @param array $array
*/
private function arraySearchInsensitive($search, array $array)
{
foreach ($array as $key => $value) {
@EmeraldCoder
EmeraldCoder / convertCsvFileToArray
Created July 10, 2013 20:20
Read a csv file and return the content in an array
/**
* Read a csv file and return the content in an array
*
* @param string $filename
* @param string $delimiter
* @return array
*/
private function _convertCsvFileToArray($filename, $delimiter)
{
$result = array();