Skip to content

Instantly share code, notes, and snippets.

696d656b michaelbramwell

Block or report user

Report or block michaelbramwell

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
michaelbramwell / typescriptEnumToString.ts
Last active Mar 21, 2018
Typescript Enum to string equivalent to C#'s enum value ToString()
View typescriptEnumToString.ts
// given enum
export enum DairyTypes {
Cheese = 1,
Milk = 2,
Eggs = 3
// output 'Eggs' equivalent to c#'s DairyTypes.Eggs.ToString()
michaelbramwell / InternalsVisibleTo.cs
Created Nov 29, 2017
Expose Internal Assembly for Unit Testing
View InternalsVisibleTo.cs
[assembly: InternalsVisibleTo("Assembly.Name")]
michaelbramwell / AddSvcAccountToAppPoolViaCMD
Created Jun 9, 2017
Add Svc Account to App Pool via CMD
View AddSvcAccountToAppPoolViaCMD
# from
%windir%\system32\inetsrv\appcmd.exe set config /section:applicationPools /[name='APP_POOL_NAME'].processModel.identityType:SpecificUser /[name='APP_POOL_NAME'].processModel.userName:DOMAIN\USER_NAME /[name='APP_POOL_NAME'].processModel.password:PASSWORD
michaelbramwell / modifiedMySqlWorkbenchImportScript
Created Apr 24, 2017
Modified MySql Workbench import from terminal
View modifiedMySqlWorkbenchImportScript
mysql --protocol=tcp --host=localhost --user=username -p --port=3306 --default-character-set=utf8mb4 --comments --database=dbname < "/path/import.sql"
View sitecore-reset-admin-password-to-default.sql
UPDATE [aspnet_Membership] SET [Password]='qOvF8m8F2IcWMvfOBjJYHmfLABc=', [PasswordSalt]='OM5gu45RQuJ76itRvkSPFw==',
[IsApproved] = '1', [IsLockedOut] = '0'
WHERE UserId IN (SELECT UserId FROM dbo.aspnet_Users WHERE UserName = 'sitecore\Admin')
View pwGenUrandom
< /dev/urandom tr -db _A-Z-a-z-0-9 | head -c16
michaelbramwell / wpdepsetup
Last active Mar 7, 2017
WordPress Dependencies Setup
View wpdepsetup
sudo add-apt-repository ppa:ondrej/apache2
sudo apt-get update
sudo apt-get install apache2 mysql-server mysql-client php libapache2-mod-php7.0 php-mysql mailutils mysql-workbench
mysql -u root -p -e "CREATE DATABASE demo; CREATE USER 'demo'@'localhost' IDENTIFIED BY 'passwordgoeshere'; GRANT ALL PRIVILEGES ON demo.* to 'demo' IDENTIFIED BY 'passwordgoeshere'; FLUSH PRIVILEGES;"
sudo adduser www-data www-data
sudo chown -R www-data:www-data /var/www
michaelbramwell / SimpleRssAtomFeedSearchForHugo.js
Created Jan 17, 2017
Simple Rss Atom Feed Search For Hugo
View SimpleRssAtomFeedSearchForHugo.js
var search = search || {};
(function(o, win) {
let _client = document.getElementById("client");
let _server = document.getElementById("server");
let _dateFmt = function(dateStr) {
const options = { year: 'numeric', month: 'short', day: 'numeric' };
return new Date(dateStr).toLocaleDateString("en-US", options);
michaelbramwell / idxOf.js
Last active Jan 14, 2017
Find the needle in the haystack
View idxOf.js
let _idxOf = function(needle){
return function(haystack){
return haystack.toLowerCase().indexOf(needle.toLowerCase()) !== -1;
// e.g
let searchTerm = "fly";
let pets = [{ name: 'George', type: 'fly' }, { name: 'Benson', type: 'dog' }];
View siteroot.cs
Item currentItem = Sitecore.Context.Item;
SiteInfo currentSiteRoot = SiteContextFactory.Sites
.Where(s => s.RootPath != "" && currentItem.Paths.Path.ToLower().StartsWith(s.RootPath.ToLower()))
.OrderByDescending(s => s.RootPath.Length)
You can’t perform that action at this time.