Skip to content

Instantly share code, notes, and snippets.

View davidisnotnull's full-sized avatar
🛠️
On contract

David Johnson davidisnotnull

🛠️
On contract
View GitHub Profile
pool:
name: Self Hosted
demands: npm
variables:
solution: '**/*.sln'
buildConfiguration: 'Release'
steps:
- task: DotNetCoreCLI@2
@davidisnotnull
davidisnotnull / powershell-commands.md
Created December 9, 2020 19:31
Useful Powershell commands

Wipes the DNS cache on your local machine. Useful for when you've migrated a server and your machine is still caching the old IP address.

Clear-DnsClientCache
@davidisnotnull
davidisnotnull / worldpay-sample-card-numbers.md
Created November 3, 2020 15:24
Worldpay Sample Card Numbers
Card Number Alternate Number
Airplus 122000000000003
American Express 34343434343434
Cartebleue 5555555555554444
Dankort 5019717010103742
Diners 36700102000000 36148900647913
Discover card 6011000400000000
JCB 3528000700000000
Laser 630495060000000000 630490017740292441
@davidisnotnull
davidisnotnull / drop-all-users.sql
Created August 20, 2020 06:51
Drop all Users in database
--Drop all Users in database
DECLARE @sql NVARCHAR(max)
SET @sql = ''
SELECT @sql = @sql+
'
print ''Dropping '+name+'''
drop user ['+name+']
'
@davidisnotnull
davidisnotnull / php.ini
Created July 21, 2020 22:11
PHP 7.4 config for Windows
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
; PHP attempts to find and load this configuration from a number of locations.
; The following is a summary of its search order:
@davidisnotnull
davidisnotnull / drupal-notes.txt
Created July 19, 2020 14:14
Things to remember when you're setting up Drupal 9
CSS and JS not working? You'll get "MIME type ('text/html') is not a supported stylesheet MIME type".
Run the following command in Drush
drush -y config-set system.performance css.preprocess 0
drush -y config-set system.performance js.preprocess 0
@davidisnotnull
davidisnotnull / CreateAdminUserAndRoles.cs
Last active July 2, 2020 11:20
Creates an Episerver Admin user with appropriate roles on a local db.
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
using EPiServer.Logging.Compatibility;
using System.Configuration.Provider;
using System.Web.Security;
namespace MyEpiserverProject.Business.Initialization
{
[InitializableModule]
[ModuleDependency(typeof(EPiServer.Web.InitializationModule))]
@davidisnotnull
davidisnotnull / bearertoken.cs
Created February 1, 2020 17:02
Add bearer token to web request
var myUri = new Uri(fullpath);
var myWebRequest = WebRequest.Create(myUri);
var myHttpWebRequest = (HttpWebRequest)myWebRequest;
myHttpWebRequest.PreAuthenticate = true;
myHttpWebRequest.Headers.Add("Authorization", "Bearer " + AccessToken);
myHttpWebRequest.Accept = "application/json";
var myWebResponse = myWebRequest.GetResponse();
var responseStream = myWebResponse.GetResponseStream();
if (responseStream == null) return null;

Install Drush on windows

composer global require drush/drush:8.*
@davidisnotnull
davidisnotnull / iis-commands.md
Last active May 2, 2019 09:48
Useful IIS commands

All of the following commands must be run in the C:\Windows\System32\inetsrv folder

This command enables pass through of error messages from PHP-FastCGI to IIS when running PHP sites, rather than just throwing a generic 500 message when something goes wrong. Replace sitename with the name of the site in IIS.

appcmd.exe set config "sitename" -section:system.webServer/httpErrors /existingResponse:"PassThrough" /commit:apphost