Skip to content

Instantly share code, notes, and snippets.

View Codenator81's full-sized avatar

Alex Poltarjonok Codenator81

  • MGP Digital
  • Latvia
View GitHub Profile
@Codenator81
Codenator81 / recursion.php
Last active March 2, 2016 09:07
Recursija
<?php
allFiles ( $dir, &$returnArr ) {
foreach( listFoldier( $dir ) as $row ) {
if( $row->isDir() ) allFiles( $dir . '/' $row, $returnArr ) else
$returnArr[] = $dir . '/' . $row;
}
}
?>
@Codenator81
Codenator81 / tag_preprocess.php
Last active January 11, 2016 22:53
Drupal 8 - Add to views field link class when fields is taxonomy referenced entity
// Drupal 8 developper http://codenator.org
function THEMENAME_preprocess_views_view_field__field_tags(&$vars) {
$rendered = $vars['field']->getItems($vars['row']);
//added icon on front of tags
$renderedArray[] = [
'#markup' => '<span class="glyphicon glyphicon-tags" aria-hidden="true"></span>'
];
if (is_array($rendered)) {
foreach ($rendered as $one) {
//dpm($one['rendered']);
#!/bin/sh
### BEGIN INIT INFO
# Provides: <SERVICE_NAME>
# Required-Start: $local_fs $network $named $time $syslog
# Required-Stop: $local_fs $network $named $time $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Script to run asp.net 5 application in background
### END INIT INFO
@Codenator81
Codenator81 / installphp7.sh
Created November 13, 2015 18:13 — forked from tronsha/installphp7.sh
Install PHP7 to Ubuntu
#!/bin/bash
apt-get update
apt-get install -y git-core autoconf bison libxml2-dev libbz2-dev libmcrypt-dev libcurl4-openssl-dev libltdl-dev libpng-dev libpspell-dev libreadline-dev
mkdir -p /etc/php7/conf.d
mkdir -p /etc/php7/cli/conf.d
mkdir /usr/local/php7
cd /tmp
git clone https://github.com/php/php-src.git --depth=1
cd php-src
./buildconf
{
"locked": false,
"version": 2,
"targets": {
"DNXCore,Version=v5.0": {
"EntityFramework.Commands/7.0.0-rc1-16146": {
"type": "package",
"dependencies": {
"EntityFramework.Relational": "7.0.0-rc1-16146",
"EntityFramework.Relational.Design": "7.0.0-rc1-16146",
@Codenator81
Codenator81 / menu.html.twig
Created July 30, 2015 19:23
Drupal 8 menu without link example
{% if item.url.RouteName() == "<none>" %}
<a>{{ item.title }}</a>
{% else %}
{{ link(item.title, item.url) }}
{% endif %}
@Codenator81
Codenator81 / example.com.nginxconf
Last active January 11, 2016 19:12
Drupal 8 NGINX
# Codenator Drupal 8 developer http://codenator.org
server {
listen 80;
server_name drupal.local;
root /home/alex/nginx/www/drupal.local/public_html;
access_log /home/alex/nginx/www/drupal.local.access.log;
error_log /home/alex/nginx/www/drupal.local.error.log info;
@Codenator81
Codenator81 / gist:411ba59a94a3157532dc
Created June 24, 2014 17:51
twig MODX controlled ))
<!DOCTYPE html>
<html>
<head>
<base href="{{ config('site_url') }}"/>
<meta charset="utf=8"/>
<title>{{ field.pagetitle }}</title>
<link type="text/css" rel="stylesheet" href='assets/css/revo.css'/>
<link rel="canonical" href="{{ link(field.id) }}"/>
{{ jQuery }}
</head>
<?php
$controllers = 'core/components/webdev/controllers/';
$routeId = $modx->resource->id;
switch ($routeId){
case 1:
$modx->getService('home','homeController',$controllers);
return $modx->home->homeAction();
break;
@Codenator81
Codenator81 / gist:f78e5d7468dfa1402b59
Last active August 29, 2015 14:02
Controller for Home page on MODX
<?php
include_once ('/../model/webdev/webdev.class.php');
class homeController extends Webdev{
function homeAction(){
$twig =& $this->modx->twig;
$field = $this->modx->resource;
$jQuery = $twig->render('chunks/jQuery.twig');
$jQueryBeautyofCode = $twig->render('chunks/jQueryBeautyofCode.twig');
$siteFooter = $twig->render('chunks/siteFooter.twig');