Skip to content

Instantly share code, notes, and snippets.

Avatar

Nick Hoàng nick-hoang

View GitHub Profile
@nick-hoang
nick-hoang / Merchello_Notification_Layout.cshtml
Last active Jul 30, 2020
Merchello - Order confirmation notification
View Merchello_Notification_Layout.cshtml
@{
Layout = null;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html data-editor-version="2" class="sg-campaigns" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<!--[if !mso]><!-->
@nick-hoang
nick-hoang / selenium-get-youtube-videos-paging.cs
Last active Jun 29, 2020
Use selenium to get the paging token, do post to youtube and parse the video list from response
View selenium-get-youtube-videos-paging.cs
class Program
{
static void Main(string[] args)
{
using (var driver = new FirefoxDriver())
{
driver.Url = "https://www.youtube.com/results?search_query=m%E1%BB%B9+t%C3%A2m";
var wait = new WebDriverWait(driver, timeout: TimeSpan.FromSeconds(30))
{
PollingInterval = TimeSpan.FromSeconds(5),
@nick-hoang
nick-hoang / Umbraco-7-create-new-content-type.cs
Created May 7, 2020
Umbraco 7: create new content type
View Umbraco-7-create-new-content-type.cs
var contentTypeService = ApplicationContext.Current.Services.ContentTypeService;
const string contentTypeAlias = "spacerSection";
var section = contentTypeService.GetContentType(contentTypeAlias);
if(section == null)
{
var abstractSection = contentTypeService.GetContentType("abstractSectionTheme");
section = new ContentType(-1)
{
Key = Guid.NewGuid(),
@nick-hoang
nick-hoang / umbracoSettings.config
Created May 6, 2020
Umbraco settings to remove vietnamese chars from Umbraco urls
View umbracoSettings.config
<?xml version="1.0" encoding="utf-8"?>
<settings>
<!--
umbracoSettings.config configuration documentation can be found here:
https://our.umbraco.com/documentation/using-umbraco/config-files/umbracoSettings/
Many of the optional settings are not explicitly listed here
but can be found in the online documentation.
-->
View remove-all-umbraco-7-tables.sql
use umbraco_db_name
Drop table schema.cmsPreviewXml
Drop table schema.cmsContentVersion
Drop table schema.cmsContentXml
Drop table schema.cmsDocument
Drop table schema.cmsMedia
Drop table schema.cmsMember2MemberGroup
Drop table schema.cmsMember
Drop table schema.cmsTagRelationship
@nick-hoang
nick-hoang / CustomLayoutController.js
Last active Oct 31, 2018
Umbraco 7 custom layout sample, reuse the default List layout
View CustomLayoutController.js
(function () {
"use strict";
function customLayoutController($scope, listViewHelper, $location, mediaHelper, mediaTypeHelper, assetsService) {
/*
* $scope.items = [
* {
* properties: [
* {
@nick-hoang
nick-hoang / Umbraco.MovePublishedContent.cs
Last active Oct 31, 2018
Umbraco - move published content without raising events
View Umbraco.MovePublishedContent.cs
public class Mover {
public void PerformMovePublishedContent(IContent content, int parentId, int userId = 0)
{
if(content.ParentId == parentId)
{
return;
}
var contentService = ApplicationContext.Current.Services.ContentService;
if (parentId == Constants.System.Root)
{
View umbraco-clear-recycle-bin.sql
--Delete old nodes (keep recent 15 days) from Trash, Umbraco 7.7.6
--deletes in Document
--at this point all associated media files are deleted
delete from umbracoDomains where id in (select id from umbracoNode where trashed = 1 and createDate < DATEADD(d, -15, getdate()));
delete from cmsDocument where nodeId in (select id from umbracoNode where trashed = 1 and createDate < DATEADD(d, -15, getdate()));
--deletes in Content
delete from cmsPropertyData where contentNodeId in (select id from umbracoNode where trashed = 1 and createDate < DATEADD(d, -15, getdate()));
delete from cmsPreviewXml where nodeId in (select id from umbracoNode where trashed = 1 and createDate < DATEADD(d, -15, getdate()));
You can’t perform that action at this time.