This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
w - move cursor to the beginning of the next word | |
e - move cursor to the end of the next word | |
) - move cursor to the beginning of the next sentence | |
( - move cursor to the beginning of the previous sentence | |
} - move cursor to the beginning of the next paragraph | |
{ - move cursor to the beginning of the previous paragraph | |
/somsething<ENTER> - search for "something", press "n" key to move next |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$msg = 'This is a super secret message!'; | |
// Generating an encryption key and a nonce | |
$key = random_bytes(SODIUM_CRYPTO_SECRETBOX_KEYBYTES); // 256 bit | |
$nonce = random_bytes(SODIUM_CRYPTO_SECRETBOX_NONCEBYTES); // 24 bytes | |
// Encrypt | |
$ciphertext = sodium_crypto_secretbox($msg, $nonce, $key); | |
// Decrypt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
path=${1%/} | |
user=${2} | |
group=${2} | |
help="\nHelp: This script is used to fix permissions of a Drupal 8 installation in which the PHP Handler is FastCGI\nYou need to provide the following arguments:\n\t 1) Path to your drupal installation\n\t 2) Username of the user that you want to give files/directories ownership\n\nNote: This script assumes that the group is the same as the username if your PHP is compiled to run as FastCGI. If this is different you need to modify it manually by editing this script or checking out forks on GitHub.\nUsage: bash ${0##*/} drupal_path user_name\n" | |
echo "Refer to https://www.Drupal.org/node/244924" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
file_url_transform_relative(file_create_url($user_picture_entity->getFileUri())); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$databases = array ( | |
'default' => | |
array ( | |
'default' => | |
array ( | |
'database' => 'database', | |
'username' => 'username', | |
'password' => 'password', | |
'host' => 'localhost', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements hook_apachesolr_query_prepare(). | |
*/ | |
function my_search_apachesolr_query_prepare($query) { | |
$query->addParams(array( | |
'group' => true, | |
'group.field' => 'path', | |
'group.main' => true, | |
) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteCond %{HTTP_HOST} ^site.donain.com$ [NC] | |
RewriteCond %{REQUEST_URI} !folder/ | |
RewriteRule ^(.*)$ folder/$1 [L] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# git up | |
git config --global alias.up '!(git add . && git stash && git pull --rebase >&2) | grep -v "No local changes to save" && git stash pop' | |
# git in / git out — смотреть какие коммиты придут/уйдут перед выполнением pull/push | |
git config --global alias.in '!git remote update -p; git log ..@{u}' | |
git config --global alias.out 'log @{u}..' | |
# git addremove - добавить в индекс новые файлы/изменения и удалить всё что удалилось | |
git config --global alias.addremove \!"git add . && git ls-files --deleted | xargs --no-run-if-empty git rm" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @Author Dmitry Kazberovich | |
*/ | |
class CustomMongoCollection extends MongoCollection | |
{ | |
private $_autoincrementFieldName; | |
public function __construct($db, $collectionName, $autoincrementFieldName = '') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function() {var url = '//www.sprymedia.co.uk/VisualEvent/VisualEvent_Loader.js';if( typeof VisualEvent!='undefined' ) {if ( VisualEvent.instance !== null ) {VisualEvent.close();}else {new VisualEvent();}}else {var n=document.createElement('script');n.setAttribute('language','JavaScript');n.setAttribute('src',url+'?rand='+new Date().getTime());document.body.appendChild(n);}})(); |
NewerOlder