Skip to content

Instantly share code, notes, and snippets.

@MajidSafari
MajidSafari / gist:f9b1be52132111cb0a69
Created November 24, 2014 21:07
Clear All Cookie C# Asp.net
string[] myCookies = Request.Cookies.AllKeys;
foreach (string cookie in myCookies)
{
var httpCookie = Response.Cookies[cookie];
if (httpCookie != null)
{
httpCookie.Expires = DateTime.Now.AddYears(-10);
Response.Cookies.Add(httpCookie);
}
var httpCookie1 = Response.Cookies[cookie];
set ansi_nulls off
if null = null
print 'true'
else
print 'false'
if null IS null
print 'true'
else
@MajidSafari
MajidSafari / uploadPanel
Created May 28, 2015 16:37
BeginRequest & EndRequest
var xPos, yPos;
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_beginRequest(BeginRequestHandler);
prm.add_endRequest(EndRequestHandler);
function BeginRequestHandler(sender, args) {
}
function EndRequestHandler(sender, args) {
}
@MajidSafari
MajidSafari / gist:2c2252030f9a8b88f393
Created July 12, 2015 09:14
smooth-scrolling ,Global
$(function() {
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
$('.error-template').delay(400).css({top: -25, opacity: 0}).animate({top: 0, opacity: 1},
@MajidSafari
MajidSafari / gist:ee9e06ec212dd9fdc7a94831d3812e4f
Created April 9, 2017 08:06
sql prompt tab history location
%UserProfile%\Local Settings\Application Data\Red Gate\
SELECT RIGHT(Email, LEN(Email) - CHARINDEX('@', email)) Domain ,
COUNT(Email) EmailCount
FROM Article.tblNewsLetter
WHERE LEN(Email) > 0 AND MailCheck=1 AND IsActive=1
GROUP BY RIGHT(Email, LEN(Email) - CHARINDEX('@', email))
ORDER BY EmailCount DESC
ALTER DATABASE [old_name]
SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
ALTER DATABASE [old_name]
MODIFY NAME = [new_name]
GO
ALTER DATABASE [new_name]
SET MULTI_USER
string EncodedResponse = Request.Form["g-Recaptcha-Response"];
bool IsCaptchaValid = (ReCaptchaClass.Validate(EncodedResponse) == "True" ? true : false);
if (IsCaptchaValid) {
//Valid Request
}
fess.201707091711/_settings
{
"max_result_window": 50000
}