This file contains hidden or 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.Linq; | |
using System.Web.Mvc; | |
public static class ModelStateDictionaryExtensions | |
{ | |
#if DEBUG | |
public static void DumpErrors(this ModelStateDictionary modelState) | |
{ | |
var errors = modelState.Where(a => a.Value.Errors.Count > 0) |
This file contains hidden or 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
(define (script-fu-xcf2jpg-batch xcfDirectory inQuality) | |
(let* ((xcfList (cadr (file-glob (string-append xcfDirectory "/*.xcf") 1)))) | |
(while (not (null? xcfList) ) | |
(let* ((xcfFilename (car xcfList)) | |
(jpgFilename (string-append (substring xcfFilename 0 (- (string-length xcfFilename) 4) ) ".jpg")) | |
(xcfImage (car (gimp-file-load RUN-NONINTERACTIVE xcfFilename xcfFilename))) | |
(xcfDrawable (car (gimp-image-flatten xcfImage))) ) | |
(file-jpeg-save RUN-NONINTERACTIVE xcfImage xcfDrawable jpgFilename jpgFilename | |
inQuality 0.0 0 0 "" 0 1 0 2) | |
) |
This file contains hidden or 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
public static class EntityLinqExtensions | |
{ | |
public static bool None<TEntity>(this IEnumerable<TEntity> items, Func<TEntity, bool> predicate) | |
{ | |
return !items.Any(predicate); | |
} | |
} |
This file contains hidden or 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
public static class EntityExtensions | |
{ | |
public static void MergeChanges<TEntity>(this TEntity targetEntity, TEntity sourceEntity) where TEntity: IPersistable | |
{ | |
var publicWritableProps = typeof(TEntity).GetProperties(BindingFlags.Instance | BindingFlags.Public); | |
foreach (var prop in publicWritableProps) | |
{ | |
if (prop.Name != "PersistenceKey") | |
{ | |
var newValue = prop.GetValue(sourceEntity, null); |
This file contains hidden or 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
#!/bin/bash | |
LAYOUTROOT=/put/a/directory/here | |
layoutName=$1 | |
projectName=$2 | |
[ -n "$layoutName" -a -n "${projectName}" -a -d "${LAYOUTROOT}/${layoutName}" ] && ( | |
layout="${LAYOUTROOT}/${layoutName}" | |
echo "Templating from ${layout}" |
This file contains hidden or 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
Get-ChildItem $myGitRepoPath | foreach { $rootDir = $_.FullName; $gitPath = join-path $_.FullName ".git"; $driveName = $_.BaseName.Replace('.','_'); if(test-path $gitPath){ New-PSDrive -name $driveName -psprovider FileSystem -root $rootDir } } |
This file contains hidden or 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
function portfolioEditorDialogdialogRequestedHandler() { | |
$(document).bind('keydown', function (event) { | |
if (event.which == 8) { | |
var target = $(event.target); | |
if (!target.is('input')) | |
event.preventDefault(); | |
} | |
}); | |
} |
This file contains hidden or 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
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | |
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=5F96955EB47AE94FA37A304345ABFE15/@KeyIndexDefined">True</s:Boolean> | |
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=5F96955EB47AE94FA37A304345ABFE15/Description/@EntryValue">Nancy Module</s:String> | |
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=5F96955EB47AE94FA37A304345ABFE15/Text/@EntryValue">
 | |
namespace $NAMESPACE$
 | |
{
 | |
using Nancy;
 | |

 | |
public class $NEW_MODULE$ : NancyModule
 | |
{
 |
This file contains hidden or 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
#!/bin/bash | |
usage() | |
{ | |
echo "Usage: $0 <svn_url> <git_url> <svn_authorsfile> [--branches]" | |
exit 1 | |
} | |
create_svn_fetch_dir() | |
{ |
This file contains hidden or 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 toSearchForm = searchTerm.Split(' '); | |
var searcher = ExamineManager.Instance.SearchProviderCollection["SiteQuickSearchSearcher"]; | |
var criteria = searcher.CreateSearchCriteria(IndexTypes.Content); | |
var fieldsToSearch = new[] | |
{ | |
"nodeName", "pageTitle", "menuText", "pageBody", "metaKeywords", | |
"metaDescription" | |
}; |
NewerOlder