Skip to content

Instantly share code, notes, and snippets.

View tmamedbekov's full-sized avatar
🤠
alert( 'Howdy, world!' );

Tony Mamedbekov tmamedbekov

🤠
alert( 'Howdy, world!' );
View GitHub Profile
@tmamedbekov
tmamedbekov / app.get
Created January 13, 2017 21:55
Simple readdir with express server. NODE.JS
var express = require('express');
var fs = require('fs');
var app = express();
app.get('/logJson', function (req, res) {
const logsFolder = '/folder/path/';
fs.readdir(logsFolder, (err, files) => {
if (err) {
@tmamedbekov
tmamedbekov / itemMoving.cs
Created June 6, 2017 14:55
Custom Code for Moving Item from one directory to another
using Sitecore.Configuration;
using Sitecore.Data.Items;
using Sitecore.Data;
using Sitecore.Data.Fields;
namespace sitecore.local.CustomCode
{
public class ItemMoving
{
private readonly Database _sourceDatabase = Factory.GetDatabase("master");
@tmamedbekov
tmamedbekov / ItemMoving.config
Created June 6, 2017 15:00
Item Moving configuration that will patch the Sitecore.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<sitecore>
<scheduling>
<!--Custom Code that will do item moving-->
<agent type="sitecore.local.CustomCode.ItemMoving" method="Execute" interval="00:00:59"/>
</scheduling>
</sitecore>
</configuration>
@using Sitecore.Mvc
@using Sitecore.Mvc.Extensions
@using sitecore.local.Controllers
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
using System.Web;
using System.Web.Mvc;
using Sitecore.Mvc.Extensions;
namespace sitecore.local.Controllers
{
public static class Angular
{
public static IHtmlString RawJsEncodedString<T>(this HtmlHelper<T> htmlHelper, HtmlString str)
{
angular.module('sc.sample', [
'ngSanitize'
]).directive('sampleComponent', function () {
return {
scope: {
data: '=sampleComponent'
},
templateUrl: `[template path]/index.html`
};
}).controller('SampleDemoController', ['$scope', function ($scope) {
<section class="row page-header sampleComponent spaced-row" ng-show="data">
<div class="col-xs-12">
<h1 class="header" ng-bind-html="data.Title | asTrusted"></h1>
</div>
<article class="col-xs-7 col-md-8">
<p ng-bind-html="data.Text | asTrusted"></p>
</article>
<figure class="col-xs-5 col-md-4">
<span ng-bind-html="data.Image | asTrusted"></span>
</figure>
@tmamedbekov
tmamedbekov / phantomjs_patch.config
Created October 31, 2018 13:46
Disable PhantomJS
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
<sitecore role:require="ContentDelivery or Reporting or Processing">
<settings>
<setting name="ContentTesting.AutomaticContentTesting.Enabled" value="false" />
<setting name="ContentTesting.AlwaysShowTestCandidateNotification" value="false" />
</settings>
<pipelines>
<renderingRuleEvaluated>
<processor type="Sitecore.ContentTesting.Pipelines.RenderingRuleEvaluated.TestingRule, Sitecore.ContentTesting">
yourApplicationName/data/routes/en.yml
import React from 'react';
import { Text, Image } from '@sitecore-jss/sitecore-jss-react';
const Profile = (props) => (
<div className="col-md-8">
<Image
field={props.fields.avatar}
className="avatar"
/>
<h1><Text field={props.fields.name} /></h1>