Skip to content

Instantly share code, notes, and snippets.

View Hameds's full-sized avatar
🎯
Focusing

Hamed Hameds

🎯
Focusing
View GitHub Profile
@Hameds
Hameds / backup_sharepoint_sites
Created August 15, 2013 04:17
Script to get backups of all web application sites in sharepoint farm
$FolderPath = "E:\Backup\"
$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
if ($snapin -eq $null)
{
Write-Host "Loading SharePoint Powershell Snapin..."
Add-PSSnapin "Microsoft.SharePoint.Powershell"
}
foreach ($SPWebApplication in (Get-SPWebApplication)) {
foreach ($Site in $SPWebApplication.Sites) {
$Filename = $FolderPath + $SPWebApplication.Name.Replace(" ","") + " " + $Site.ServerRelativeUrl.Replace("/","_")+ ".bak"
@Hameds
Hameds / ReplaceYeKe.sql
Last active April 23, 2024 08:23
Replace Arabic ي & ك in SQL Server Database with Persian characters
use [DATABASE_NAME];
DECLARE @Table NVARCHAR(MAX)
DECLARE @Col NVARCHAR(MAX)
DECLARE Table_Cursor CURSOR
FOR
--پيدا کردن تمام فيلدهاي متني تمام جداول ديتابيس جاري
SELECT a.name, --table
b.name --col
FROM sysobjects a,
syscolumns b
@Hameds
Hameds / LogUnhandledExceptionsInGlobalasaxUsingNlog.cs
Created July 8, 2017 07:23
automatically log unhandled exceptions in ASP.NET project using NLog
protected void Application_Error()
{
Exception lastException = Server.GetLastError();
NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
logger.Fatal(lastException);
}
@Hameds
Hameds / keybase.md
Created October 27, 2017 13:04
keybase.md

Keybase proof

I hereby claim:

  • I am hameds on github.
  • I am hamed (https://keybase.io/hamed) on keybase.
  • I have a public key ASB3tTeS9Jaex7SK6sWQCVQi-gHB1yVBvUS-okyRrevoXQo

To claim this, I am signing this object:

@Hameds
Hameds / jQueryFileModule.xml
Created November 1, 2017 12:52
jQueryFileModule.xml
<!--?xml version="1.0" encoding="utf-8"?-->
<elements xmlns="http://schemas.microsoft.com/sharepoint/">
<module name="jQueryFileModule">
<file path="jQueryFileModulejquery-1.10.2.min.js" url="jquery-1.10.2.min.js">
</file></module>
</elements>
@Hameds
Hameds / spjQueryCustomAction.xml
Created November 1, 2017 12:56
spjQueryCustomAction
<sharepoint:scriptlink language="javascript" name="core.js" ondemand="true" runat="server">
</sharepoint:scriptlink>
<!--?xml version="1.0" encoding="utf-8"?-->
<elements xmlns="http://schemas.microsoft.com/sharepoint/">
<customaction id="0a084c02-09bd-4af5-a8e0-78ec0544e776" sequence="100" location="ScriptLink" title="jQueryAction" scriptsrc="~site/jquery-1.10.2.min.js">
</customaction></elements>
string siteUrl="http://spserver:81/sites/test";
SPSite site=new SPSite(siteUrl);
string siteUrl="http://spserver:81/sites/test";
SPSite site=new SPSite(siteUrl);
SPWeb web=site.RootWeb;
string siteUrl="http://spserver:81/sites/test";
SPSite site=new SPSite(siteUrl);
SPWeb web=site.OpenWeb();