Skip to content

Instantly share code, notes, and snippets.

@mdnmdn
mdnmdn / ULSLog
Created March 12, 2014 08:46
Sharepoint log on ULS
SPDiagnosticsService.Local.WriteTrace(0,
new SPDiagnosticsCategory(this.NamingContainer.ToString(),
TraceSeverity.Unexpected,
EventSeverity.Error),
TraceSeverity.Unexpected,
ex.Message,
ex.StackTrace);
@mdnmdn
mdnmdn / WorkWithPropertyBag.ps1
Last active August 29, 2015 14:00
Manage Sharepoint element property bag from powershell
if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) {
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}
$web = Get-SPWeb 'http://win13a/sites/dev'
$web.AllProperties['PropertyName'] = '312'
$web.Update()
$webApp = Get-SPWebApplication 'http://win13a/'
@mdnmdn
mdnmdn / SampleService.csproj
Last active August 29, 2015 14:01
WCF REST on Sharepoint
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<!-- .... -->
<!--
Add .svc to let build tool to substitute$SharePoint.Project.AssemblyFullName$ like
placeholders during build process.
@mdnmdn
mdnmdn / sp.dialog.js
Created May 16, 2014 09:18
Sharepoint 2013 JS waiting dialog
var dialog = null;
function showDialog(){
SP.SOD.loadMultiple(['sp.ui.dialog.js','strings.js'], function(){
dialog = SP.UI.ModalDialog.showWaitScreenWithNoClose("Please wait...", 'Loading data', null, null);
});
}
@mdnmdn
mdnmdn / mongodb.conf
Created September 3, 2014 23:27
Minimal data size mongodb configuration
# execute as: mongod -f mongodb.conf
storage.preallocDataFiles: false
storage.nsSize: 4
storage.smallFiles: true
storage.dbPath: "mongodata/"
@mdnmdn
mdnmdn / rt
Created December 23, 2014 14:18
OSX routing table management
# with VPN, add an host skipping VPN
sudo route add -host 10.0.0.145 -gateway 10.0.0.3
# remove entry
sudo route delete -host 10.0.0.145
# show all routes
netstat -nr
@mdnmdn
mdnmdn / Xcode6.md
Last active August 29, 2015 14:12
Xcode6 - Jailbroken deploy iOS
@mdnmdn
mdnmdn / extract-urls.sh
Created September 23, 2015 13:18
Extract all http base address from a file
grep -E "https?\:" filename.config | sed -E 's/^.*(https?:\/\/[^\/"]+).*$/\1/' | sort | uniq
# use to copy to clipboard (osx only) | pbcopy
@mdnmdn
mdnmdn / gist:1409182
Created November 30, 2011 14:07
NHibernate Base Context class
public class NHContext :IDisposable
{
#region init
protected static ISessionFactory _sessionFactory;
public ISessionFactory SessionFactory {
get {
if (_sessionFactory == null) Init();
@mdnmdn
mdnmdn / uploadfile.ps1
Created December 18, 2011 14:18
Upload file to a sharepoint doc library via powershell
$siteUrl = "http://sharepoint/"
$listName = "Site Assets"
$fileName = "OfferApp.xap"
$filePath = "OfferApp.Web\ClientBin\" + $fileName
[system.reflection.assembly]::LoadWithPartialName("Microsoft.Sharepoint")
$site = New-Object Microsoft.SharePoint.SPSite($siteUrl)
$web = $site.OpenWeb()