Skip to content

Instantly share code, notes, and snippets.

@wpsmith
wpsmith / gist:6067068
Created July 23, 2013 23:39
RegEx: Notepad++ Append & Prepend to each line
Press CTRL-H to bring up the Find/Replace Dialog. Choose the "Regular expressions" checkbox near the bottom of the dialog.
To add "test" to the beginning of each line, type "^" in the "Find what" field, and "test" in the "Replace with" field. Then hit "Replace All".
To add "test" to the end of each line, type "$" in the "Find what" field, and "test" in the "Replace with" field. Then hit "Replace All".
@wpsmith
wpsmith / articulate-email.js
Created March 22, 2013 13:34
Creates New Email with To, Subject, and basic body text.
var player = GetPlayer();
var email = player.GetVar("ManagerEmail");
var name = player.GetVar("Name");
var texto = player.GetVar("Commitment") + "\n";
var subject = "My Corporate Responsibility Commitment";
var body_start = "Dear Manager,\n" + name + " has sent you his/her Corporate Responsibility Commitment:\n";
var body_end = "Please discuss this commitment with " + name + "\n";
var mailto_link = 'mailto:' + email + '?subject=' + subject + '&body=' + encodeURIComponent(body_start + texto + body_end);
win = window.open(mailto_link, 'emailWin');
@wpsmith
wpsmith / Tetris_Shortcode.php
Created September 27, 2015 19:31
PHP: Tetris WordPress Shortcode
<?php
/**
* Class Tetris_Shortcode
*/
class Tetris_Shortcode {
/**
* Whether in debug mode or not.
* @var bool
/*
* metro-bootstrap files
*/
.tile {
display: block;
cursor: pointer;
-webkit-perspective: 0;
-webkit-transform-style: preserve-3d;
-webkit-transition: -webkit-transform 0.2s;
float: left;
@wpsmith
wpsmith / composer.json
Last active October 11, 2022 21:42
PHP: Hide User Mu-Plugin
{
"name": "wpsmith/hide-user",
"description": "Hides user in WordPress Admin.",
"type": "project",
"license": "GPLv2+",
"authors": [
{
"name": "Travis Smith",
"email": "t@wpsmith.net"
}
@wpsmith
wpsmith / Set-WebApplicataionPool.ps1
Created April 2, 2015 16:32
PowerShell - Change SharePoint Web Application Pool
#---------------------------------------------------------------------------------------
# Name: Set-WebApplicataionPool.ps1
# Description: This script will change SP WebApplication Pools for a Web Application
#
# Usage: Run the function with the required parameters
# By: Ivan Josipovic, Softlanding.ca
#---------------------------------------------------------------------------------------
Function Set-WebApplicataionPool($WebAppURL,$ApplicationPoolName){
$apppool = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.ApplicationPools | where {$_.Name -eq $ApplicationPoolName}
if ($apppool -eq $null){
@wpsmith
wpsmith / CopyFilesToAzureStorageContainer.ps1
Created November 25, 2014 20:25
PowerShell: Copy Files to Azure Storage Container
<#
.SYNOPSIS
Copies files from a local folder to an Azure blob storage container.
.DESCRIPTION
Copies files (in parallel) from a local folder to a named Azure storage
blob container. The copy operation can optionally recurse the local folder
using the -Recurse switch. The storage container is assumed to already exist
unless the -CreateContainer switch is provided.
Note: This script requires an Azure Storage Account to run. The storage account
@wpsmith
wpsmith / WPS_Ajax.php
Created August 13, 2015 21:14
PHP/JS: WordPress Ajax as OOP.
<?php
/**
* WP Ajax Abstract Class.
*
* @package WPS_Core
* @author Travis Smith <t@wpsmith.net>
* @copyright 2014 Travis Smith
* @license GPL-2.0+
*/
@wpsmith
wpsmith / wps_force_ssl_shopp_urls.php
Created June 10, 2013 17:07
Conditionally add https scheme to URLs.
<?php
add_filter( 'shopp_url', 'wps_force_ssl_shopp_urls', 999 );
/**
* Conditionally add https scheme to URLs.
*
* @param string $url URL string.
*
* @return string $url Maybe modified URL.
*/
@wpsmith
wpsmith / get-cookie.js
Created July 5, 2015 21:50
JavaScript: Get Cookie By Name