This file contains 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
Regex rxnum = new Regex(@"(\d+(?! */))? *-? *(?:(\d+) */ *(\d+))?.*$"); | |
Match numMatch = rxnum.Match(ingredient); | |
if (numMatch.Success) | |
{ | |
amount = (!string.IsNullOrEmpty(numMatch.Groups[1].Value) ? numMatch.Groups[1].Value : string.Empty) + (!string.IsNullOrEmpty(numMatch.Groups[2].Value) ? " " + numMatch.Groups[2].Value + "/" + numMatch.Groups[3].Value : string.Empty); | |
// do something with the amount... | |
} |
This file contains 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 MD5Hash(string input) | |
{ | |
StringBuilder hash = new StringBuilder(); | |
MD5CryptoServiceProvider md5provider = new MD5CryptoServiceProvider(); | |
byte[] bytes = md5provider.ComputeHash(new UTF8Encoding().GetBytes(input)); | |
for (int i = 0; i < bytes.Length; i++) | |
{ | |
hash.Append(bytes[i].ToString("x2")); | |
} |
This file contains 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
Regex.Split(inputString, "<br>"); | |
This file contains 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.Web.Mvc; | |
public static class GravatarExtensions | |
{ | |
public static MvcHtmlString Gravatar(this HtmlHelper helper, string email, string username, int size) | |
{ | |
var baseURL = "http://www.gravatar.com/avatar/{0}?s={1}&d=identicon&r=PG"; | |
TagBuilder link = new TagBuilder("a"); | |
link.Attributes.Add("href", "/User/" + username); |
This file contains 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
// POST all the datas! except the ViewState | |
jQuery.post('https://www.example.com', jQuery("#form :not(#__VIEWSTATE) > :input").serialize() ,function(data,status){ | |
if(data[0]["Status"] == "Success"){ | |
jQuery("#poststatus").html("Thank you!"); | |
}else{ | |
jQuery("#poststatus").html("There has been an error while accepting your submission. Please contact us."); | |
} | |
}); |
This file contains 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
!!! | |
%html | |
%head | |
%title | |
= content_for?(:title) ? yield(:title) : "" | |
%body | |
= yield |
This file contains 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
<div id="opacity" data-animated-property="opacity" data-animated-from="1" data-animated-to="0"></div> |
This file contains 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
source ~/.zshrc | |
# or the shorter | |
. ~/.zshrc | |
# In the .zshrc file you can add an alias such as | |
alias zshreload="source ~/.zshrc" | |
# You can then just type zshreload after making changes to your .zshrc file. |
This file contains 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
# Path to your oh-my-zsh installation. | |
export ZSH=$HOME/.oh-my-zsh | |
# Set name of the theme to load. | |
# Look in ~/.oh-my-zsh/themes/ | |
# Optionally, if you set this to "random", it'll load a random theme each | |
# time that oh-my-zsh is loaded. | |
ZSH_THEME="pygmalion" | |
# Example aliases |
This file contains 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
sudo apt-get install virtualbox-guest-utils virtualbox-guest-x11 virtualbox-guest-dkms |
OlderNewer