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 | |
| function do_if(){ | |
| echo $1 "(y/n)" | |
| read install | |
| if [ $install == "y" ] | |
| then | |
| echo $2 | |
| eval $2 | |
| fi | |
| } |
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
| Git kommandon som är bra att känna till | |
| Hämta ut commit där man satte TAG | |
| git rev-list $TAG | head -n 1 | |
| Alias till trevlig log (git lg) | |
| git config --global alias.lg "log --pretty=format:'%Cgreen%h%Creset : %C(bold)%s %Creset(%an, %ar)'" | |
| För mac med mörkt tema: | |
| git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" |
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
| require 'iconv' | |
| def convert_to_windows1252 (input) | |
| ic = Iconv.new('Windows-1252', 'CP850') | |
| return ic.iconv(input + ' ')[0..-2] | |
| end |
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 LdapParser | |
| { | |
| private static readonly Regex Parser = new Regex("^cn=(?<object>.*?),(?<context>.*)$", RegexOptions.IgnoreCase); | |
| public static T Parse<T>(string s) where T : LdapObject, new() | |
| { | |
| if (string.IsNullOrWhiteSpace(s)) return default(T); | |
| var m = Parser.Match(s); | |
| return |
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 SetupWithHttpContextAndUrlHelper(this Controller controller) | |
| { | |
| var routes = new RouteCollection(); | |
| MvcApplication.RegisterRoutes(routes); | |
| //setup request | |
| var requestContextMock = new Mock<HttpRequestBase>(); | |
| requestContextMock.Setup(r => r.AppRelativeCurrentExecutionFilePath).Returns("/"); | |
| requestContextMock.Setup(r => r.ApplicationPath).Returns("/"); |