Skip to content

Instantly share code, notes, and snippets.

View janikvonrotz's full-sized avatar
:octocat:

Janik von Rotz janikvonrotz

:octocat:
View GitHub Profile
@janikvonrotz
janikvonrotz / Update Foreign Key.vbs
Created June 10, 2013 14:51
MSAccess: Update Foreign Key #VisualBasic #MSAccess
Public Sub ListVerweisAktualisieren(ListControl As Control, TableName As String, TableLinkName As String, Values As Variant, IDDataSet As String, IDDataSetName As String, LinkDataSetName As String)
Dim db As DAO.Database
Set db = CurrentDb
Dim AnzahlItems As Integer
AnzahlItems = ListControl.ListCount
Dim ValueIndex As Integer
ValueIndex = 0
@janikvonrotz
janikvonrotz / Create Foreign Key.vbs
Created June 10, 2013 14:51
MSAccess: Create Foreign Key #VisualBasic #MSAccess
Public Sub VerweisErstellen(TableVerw As String, IDSource As String, IDSourceValue As Integer, IDDest As String, IDDestValue As Integer)
Dim db As DAO.Database
Set db = CurrentDb
'Delete of all Register data in link table
db.Execute "DELETE * FROM " & TableVerw & " WHERE " & IDSource & " = " & IDSourceValue, dbFailOnError
'Link the Register to the selected value
db.Execute "INSERT INTO " & TableVerw & " (" & IDSource & "," & IDDest & " ) VALUES(" & IDSourceValue & ", " & IDDestValue & ")"
@janikvonrotz
janikvonrotz / Apache Rewrite Rules.txt
Created June 10, 2013 14:52
Apache: Rewrite Rules #Apache
#Rewerite canonical URL
RewriteEngine On
RewriteCond %{HTTP_HOST} ^snippetdb.com$
RewriteRule (.*) http://www.snippetdb.com$1 [R=301]
#.htaccess rewrite examples should begin with: ^
Options +FollowSymLinks
RewriteEngine On
@janikvonrotz
janikvonrotz / Header Metadata.html
Created June 10, 2013 14:57
Header Metadata HTML #HTML
<!-- Meta windows tile icon -->
<meta name="msapplication-TileColor" content="#123456"/>
<meta name="msapplication-TileImage" content="your_logo.png"/>
<!-- Meta Apple touch icon -->
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<link rel="apple-touch-icon-precomposed" href="/apple-touch-icon-precomposed.png" />
@janikvonrotz
janikvonrotz / Compatibility.ps1
Last active December 18, 2015 07:49
PowerShell: Snippets #PowerShell #SnippetContainer
# Check for executeable
if ((Get-Command "cmdkey.exe") -and (Get-Command "mstsc.exe")) { }
# Execute with Powershell version 2 instead of version 3 and higher
if($Host.Version.Major -gt 2){
powershell -Version 2 $MyInvocation.MyCommand.Definition
exit
}
# only powershell 2 and higher
@janikvonrotz
janikvonrotz / AdvancedFuntionTemplate.ps1
Created June 10, 2013 15:05
PowerShell: Function Template #PowerShell #CodingStandards
<#
$Metadata = @{
Title = ""
Filename = ""
Description = ""
Tags = ""
Project = ""
Author = "Janik von Rotz"
AuthorContact = "http://janikvonrotz.ch"
CreateDate = "yyyyy-mm-dd hh:mm"
@janikvonrotz
janikvonrotz / MinifiedHelp.ps1
Created June 10, 2013 15:05
PowerShell: PowerGUI Advanced Function Template #PowerShell #CodingStandards
<#
.SYNOPSIS
Sends a default error Report based on the PowerShell Profile configurations.
.DESCRIPTION
Sends a default error Report based on the PowerShell Profile configurations.
.PARAMETER FileName
The description of the ParameterA parameter.
@janikvonrotz
janikvonrotz / Get-AllSPLists.ps1
Last active February 28, 2024 12:19
PowerShell: Get SharePoint Site Collection Objects #PowerShell #SharePoint
Get-SPsite -Limit all | %{
$_ | Get-SPWeb -Limit all | %{
$_.Lists | %{
$_
}
}
}
@janikvonrotz
janikvonrotz / LoadModulesAndSnapins.ps1
Created June 10, 2013 15:11
PowerShell: Load modules and snapins #PowerShell
# import all mdoules
Get-Module -ListAvailable | Import-Module
# show module commands
Get-Command –Module grouppolicy
#--------------------------------------------------#
# SharePoint
#--------------------------------------------------#
if(-not (Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue)){Add-PSSnapin "Microsoft.SharePoint.PowerShell"}
@janikvonrotz
janikvonrotz / Get-SQLServerEdition.sql
Created June 25, 2013 06:10
SQL Server: Get SQLServer Edition #SQLServer
SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition')