Skip to content

Instantly share code, notes, and snippets.

View v1talii-dev's full-sized avatar

Vitalii Demchuk v1talii-dev

View GitHub Profile
@v1talii-dev
v1talii-dev / README.md
Last active August 27, 2016 19:53
ATOM hotkeys

ATOM hotkeys

Hotkey Plugin/command
alt+shift+t TODO, FIXME, CHANGED, IDEA, HACK, NOTE, REVIEW
shift+alt+p Project manager
ctrl+shift+m Markdown preview
ctrl+alt+o Remote FTP, FTPs, SSH
ctrl+alt+b Beautify
ctrl+alt+g Create GIST from file
@v1talii-dev
v1talii-dev / module.info
Last active August 30, 2016 06:42
D7: "*.info" file structure
; @see https://www.drupal.org/node/542202
name = Test
package = Custom
description = Description
core = 7.x
version = 7.x-0.1
configure = admin/config/services/test
scripts[] = test.js
stylesheets[all][] = test.css
dependencies[] = jquery_update
@v1talii-dev
v1talii-dev / custom_block.php
Last active August 29, 2016 13:32
D7: programmatically create block
<?php
/**
* Implements hook_block_info();
*/
function hook_block_info() {
$blocks['test'] = array(
'info' => t('Description'),
'cache' => DRUPAL_NO_CACHE,
);
@v1talii-dev
v1talii-dev / theme.php
Last active August 29, 2016 13:31
D7: theme template in module
<?php
# ------------------------------------------------------------------------------
# test.module
# ------------------------------------------------------------------------------
/**
* Implements hook_theme().
*/
function test_theme() {
return array(
'test_panel' => array(
@v1talii-dev
v1talii-dev / test.install
Last active July 11, 2017 18:39
D7: custom table in module
<?php
# test.install
/**
* Implements hook_schema().
*
* @see https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_schema/7.x
* @link https://www.drupal.org/node/146862
*/
@v1talii-dev
v1talii-dev / test.module.php
Last active August 30, 2016 07:00
D7: hook_menu() variants
# test.module
<?php
/**
* Implements hook_menu().
*
* @see https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_menu/7.x
*/
function mymodule_menu() {
# In main menu.
@v1talii-dev
v1talii-dev / script.js
Created August 30, 2016 09:40
javascript: hide element when clicked outside this element
$(document).on('click', function(e) {
if($(e.target).closest("#block").length) {
return;
}
if (!$(e.target).closest(".control").length) {
// hide element;
e.stopPropagation();
}
@v1talii-dev
v1talii-dev / style.css
Last active September 1, 2016 12:11
Css: Transitions on the display: property
div > ul {
visibility: hidden;
opacity: 0;
transition: visibility 0s, opacity 0.5s linear;
}
div:hover > ul {
visibility: visible;
opacity: 1;
}
/* Copyright: http://stackoverflow.com/questions/3331353/transitions-on-the-display-property#answer-6943704 */
@v1talii-dev
v1talii-dev / manual.md
Last active September 1, 2016 15:05
Server: localhost apache configurate

Create new config /etc/apache2/sites-available/test.dev.conf

<VirtualHost *:80>
	ServerName test.dev
	ServerAdmin webmaster@localhost
	DocumentRoot /var/www/test.dev
	Options Indexes FollowSymLinks MultiViews
	ErrorLog /error.log
	CustomLog /access.log combined
@v1talii-dev
v1talii-dev / main.sh
Last active September 2, 2016 11:07
Server: migrate from php5 to php7 on Ubuntu 14.04 (for Drupal 7)
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.0 php7.0-mysql php7.0-gd php-xml php7.0-mbstring php7.0-zip php-curl
# Change version php for Apache
sudo a2dismod php5.6
sudo a2enmod php7.0
sudo service apache2 restart