Skip to content

Instantly share code, notes, and snippets.

View conrjac's full-sized avatar
🪁
Focusing

Connor Jackson conrjac

🪁
Focusing
View GitHub Profile
@conrjac
conrjac / vCalendarPage.html
Created August 9, 2018 08:37 — forked from douglascayers/vCalendarPage.html
Create .ics Calendar Event in Visualforce
<!--
Simple proof-of-concept to create a .ics calendar event with visualforce.
Inspired by Natalie Regier @gnatrae
This example uses url parameters to set the details of event.
You could create a custom button that invokes this page, like:
https://<your-salesforce-domain>/apex/vCalendarPage?start={!TEXT(Obj.StartDate__c)}&end={!TEXT(Obj.EndDate__c)}&subject=Event from Visualforce&description=This .ics event created with visualforce&location=The Cloud
An example with literal values you can copy & paste in your browser:
https://<your-salesforce-domain>/apex/vCalendarPage?start=20140524T140000&end=20140524T153000&subject=Event from Visualforce&description=This .ics event created with visualforce&location=The Cloud
cat C:\OLD_Computers.csv | Get-ADComputer | Remove-ADObject
import-module activedirectory
$DaysInactive = 90
$time = (Get-Date).Adddays(-($DaysInactive))
# Get all AD computers with lastLogonTimestamp less than our time
Get-ADComputer -Filter {LastLogonTimeStamp -lt $time -and OperatingSystem -notlike "*server*"} -Properties LastLogonTimeStamp,OperatingSystem |
# Output hostname and lastLogonTimestamp into CSV
select-object Name | export-csv C:\OLD_Computers.csv -notypeinformation
@conrjac
conrjac / convertISO8601.cls
Created December 13, 2017 14:47
convert ISO8601 dates to SalesForce DateTime
public DateTime convertISO8601(string str)
{
return (DateTime)json.deserialize('"' + str + '"', datetime.class);
}
@conrjac
conrjac / ApexJSON.cls
Created August 9, 2017 08:33
Apex Class of SomeJSON.json
public class JsonParser{
public glossary glossary{get;set;}
public class GlossList{
public GlossEntry GlossEntry{get;set;}
}
public class GlossEntry{
public String Abbrev{get;set;}
public String Acronym{get;set;}
public String GlossTerm{get;set;}
public GlossDef GlossDef{get;set;}
@conrjac
conrjac / SomeJSON.json
Created August 9, 2017 08:31
SomeJSON
{
"glossary": {
"title": "example glossary",
"GlossDiv": {
"title": "S",
"GlossList": {
"GlossEntry": {
"ID": "SGML",
"SortAs": "SGML",
"GlossTerm": "Standard Generalized Markup Language",
@conrjac
conrjac / mergeCSVFiles.ps1
Created November 17, 2016 09:52
Powershell Script to merge multiple CSV files into one (by appending each file to the end)
$files = Get-ChildItem [INPUT FOLDER PATH - e.g C:\Data\]*.csv
Get-Content $files | Set-Content [OUTPUT FILE PATH - e.g C:\Data\MergedCsvFile.csv]
@conrjac
conrjac / .gitignore
Created November 2, 2016 13:25
SalesForce Git Ignore
.project
.settings
.metadata
salesforce.schema
Referenced Packages
*.sublime-project
*.sublime-settings
*.sublime-workspace
apex-scripts/log
build.properties
@conrjac
conrjac / SendEmailEx.ps1
Created October 20, 2016 15:35
PowerShell Send Email from Exchange
function sendLoggingEMail($subject,$message){
Write-Host &quot;Sending Email&quot;
#Exchange Server
$exchangeServer = &quot;Exchange Address e.g webmail.domain.tld&quot;
#Creating a Mail object
$msg = new-object Net.Mail.MailMessage
#Creating SMTP server object
$smtp = new-object Net.Mail.SmtpClient($exchangeServer)
#Email structure
$msg.From = &quot;example@domain.tld&quot;
@conrjac
conrjac / MySQLBackup.sh
Created October 20, 2016 15:34
Simple MySQL Backup Shell Script
#!/bin/bash
USER="BACKUP-USER-ACCOUNT"
PASSWORD="BACKUP-USER-PASSOWRD"
TIME_STAMP=$(date +%Y-%m-%d-%T)
ROOT_BACKUP="BACKUP-LOCATION-ROOT"
BACKUP_LOCATION="${ROOT_BACKUP}/${TIME_STAMP}"
mkdir -p ${BACKUP_LOCATION}