Skip to content

Instantly share code, notes, and snippets.

View leandromoh's full-sized avatar
💭
Talk is Cheap, Show me the code!

Leandro Fernandes leandromoh

💭
Talk is Cheap, Show me the code!
View GitHub Profile
//ModelStateDictionary
var erros = ModelState.Values.SelectMany(x => x.Errors.Select(y => y.ErrorMessage)).ToList();
([01]\d|2[0-3])(:[0-5]\d){2}
dar pull na branch destino pra atualizar a local
dar o merge local nas duas branchs (aqui vai ficar o <<<<<<< HEAD no arquivo)
-commita merge com conflitos
resolvou conflitos nos arquivos da branch de destino (local)
git add nos arquivos que deram conflito, porq automaticamente eles ficam untracked
-commita a resolução de conflitos
git push
https://color.adobe.com/pt/explore/newest/
lookahead positive
/foo(?=bar)/ match foo in Hello foobar
lookahead negative
/foo(?!bar)/ matches 'foo', only if it is NOT followed by 'bar'
Lookbehind positive
/(?<=foo)bar/ matches 'bar' only if it is preceded by 'foo'
Lookbehind negative
<!-- 20480 = 1024 x 20 = 20 Megas -->
<httpRuntime targetFramework="4.5" maxRequestLength="20480" />
Regex to validate password strength
^(?=.*[A-Z].*[A-Z])(?=.*[!@#$&*])(?=.*[0-9].*[0-9])(?=.*[a-z].*[a-z].*[a-z]).{8}$
Explanation:
^ Start anchor
(?=.*[A-Z].*[A-Z]) Ensure string has two uppercase letters.
(?=.*[!@#$&*]) Ensure string has one special case letter.
(?=.*[0-9].*[0-9]) Ensure string has two digits.
text between ** means match
(\d)(\1)+
*11111111111111*
123456789
12*4444444*56
function copyInputValues($from, $to){
var fields = $from.find(":input").serializeArray();
jQuery.each(fields, function(i, field) {
var $temp = $to.find(":input[name='"+field.name+"']");
$temp.attr({value:field.value});
$temp.val(field.value);
});
}
public static string FormatAsCNPJ(this string str)
{
long number;
return long.TryParse(str, out number) ? number.ToString(@"00\.000\.000\/0000\-00") : null;
}
public static string FormatAsCPF(this string str)
{
long number;