Skip to content

Instantly share code, notes, and snippets.

@sodacrackers
sodacrackers / post-commit.sh
Created January 3, 2020 06:05
Git post commit deploy
#!/bin/sh
# set -x
# set -v
#
#
# This script deploys your code to the production/ LIVE site.
#
# To make use of this git hook, it can be copied to `.git/post-commit`
# in the folder root. It's then triggered after each git commit.
# Git offers hooks on many different git activities and, this custom
@sodacrackers
sodacrackers / simple_shibb.module.php
Created January 13, 2017 22:08
Drupal 7 Shibboleth 2 Authentication Module
<?php
function simple_shibb_init() {
$shib_session = _simple_shibb_get_session_username();
$drupal_session = user_is_logged_in();
if($drupal_session && !$shib_session) {
$force_logout = _simple_shibb_get_setting('logout_expired_sessions');
@sodacrackers
sodacrackers / UpdateSPContentSourceFromRSS.ps1
Created October 30, 2016 03:13
PowerShell to update SharePoint 2013 search content source start addresses from a remote RSS feed
Write-Host "---"
Write-Host "--- Starting job $MyInvocation.ScriptName"
Write-Host "--- Copies URLs from SharePoint list to the URLs list of a search content source"
Write-Host "---"
Add-PSSnapin Microsoft.SharePoint.PowerShell
function Execute-Updates {
@sodacrackers
sodacrackers / powershell-refresh-deploy.ps1
Last active January 3, 2020 06:02
PowerShell to backup folders, download git repo, and create IIS site for Drupal
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process -Force
$verbosePreference = "Continue"
// Relies on Powershell.MWA for Internet Information Servives routines
// Download to .\Powershell.MWA-master
// @see https://github.com/jgigler/Powershell.MWA
Import-Module WebAdministration
Import-Module "$(Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)\Powershell.MWA-master\Powershell.MWA.psm1"
Push-Location $env:temp
@sodacrackers
sodacrackers / mac_yosemite_windows_startup_choice.scpt
Created September 22, 2015 17:04
Mac 10.10 Mac Yosemite - Parallels Desktop OS Chooser Login Items Script
-- From Mac ScriptEditor, export as "Application" and add to startup items
set os_mac to "Mac"
set os_windows to "Windows 7"
set os_choice to os_mac
set os_windows_image to POSIX file "/Users/Shared/Parallels/Windows 7.pvm"
set log_file to "/log.txt"
@sodacrackers
sodacrackers / template.php
Created September 8, 2015 21:03
Drupal 7 - Primary tabs with Bootstrap dropdown and Font Awesome icons
// Snippet for template.php file
// Two Drupal hooks to move primary tabs into a dropdown and, to use
// fontawesome icons for Drupal's edit menue. Requires Bootstrap components and Fontawesome CSS.
// Better than a module.
function THEME_menu_local_tasks(&$variables)
{
$output = '<div class="btn-group pull-right sphsc-tab-tasks">'
. '<button class="btn btn-info btn-lg dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">'
. t('Actions') . '<span class="caret"></span></button>'