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 firstRowText(text) { | |
| return text.match(/^(.*)$/m)[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
| $packageName = '{PACKAGE_NAME}' | |
| $url = 'http://SITE.COM/FILE.ZIP' | |
| $subFolderFilter = '*SUBFOLDER*' | |
| try { | |
| $rootDir = Join-Path "$env:systemdrive\" $packageName | |
| if (Test-Path "$rootDir") { | |
| Write-Host "Removing existing files, keeping config-files" | |
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 string TrimBom(string text, Encoding encoding) | |
| { | |
| var bom = encoding.GetPreamble(); | |
| if (bom.Length < 1) | |
| { | |
| return text; | |
| } | |
| var textBytes = Convert.FromBase64String(text); | |
| if (!textBytes.Take(bom.Length).SequenceEqual(bom)) |
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 throttleFn(fn, wait, context) { | |
| wait = wait || defaultThrottleWait; | |
| var last, timeoutId; | |
| return function() { | |
| var ctx = (context || this), | |
| now = +new Date, | |
| args = arguments; | |
| if (last && now < (last + wait)) { |
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 StringExtensions | |
| { | |
| public static string EnsureEndsWith( | |
| this string value, | |
| string endValue, | |
| StringComparison comparisonType = StringComparison.CurrentCulture) | |
| { | |
| return (value == null || value.EndsWith(endValue, comparisonType)) ? value : (value + endValue); | |
| } |
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 matchFirst(arr, predicateFn) { | |
| var index = -1; | |
| arr.some(function(x, i) { | |
| var isMatch = predicateFn(x, i); | |
| if (isMatch) { | |
| index = i; | |
| return true; | |
| } | |
| }); |
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
| # Check if PowerShell Profile-file exists | |
| Test-Path $profile | |
| # if "false" create Profile-file | |
| New-Item -path $profile -type file –force | |
| # Start editing file at | |
| # C:\Users\[USERNAME]\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 |
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 void MapMvcAttributeRoutes( | |
| this RouteCollection routeCollection, | |
| Assembly controllerAssembly, | |
| IInlineConstraintResolver constraintResolver = null) | |
| { | |
| var controllerTypes = (from type in controllerAssembly.GetExportedTypes() | |
| where | |
| type != null && type.IsPublic | |
| && type.Name.EndsWith("Controller", StringComparison.OrdinalIgnoreCase) | |
| && !type.IsAbstract && typeof(IController).IsAssignableFrom(type) |
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
| // http://stackoverflow.com/q/10659097/2429 | |
| $('input[type=text]').on('change input propertychange paste', function() {}); |
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 ExpandoObject ToDynamic(this object obj) | |
| { | |
| var expandoObject = new ExpandoObject(); | |
| if (obj == null) | |
| { | |
| return expandoObject; | |
| } | |
| var dictionaryValues = new RouteValueDictionary(obj); | |
| if (!dictionaryValues.Any()) |