This file contains 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 | |
/** | |
* @file | |
* Provide sql expression where the value between columns | |
* | |
* @copyright Copyright (c) 2014 HTML&CMS (http://html-and-cms.com) | |
* @license http://framework.zend.com/license/new-bsd New BSD License | |
*/ | |
namespace HTMLandCMS\Db\Sql\Predicate; |
This file contains 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
(function($) { | |
$(document).ready() { | |
var $forms = $('form'); | |
$forms.find(':radio').change(function() { | |
var sisyphus = Sisyphus.getInstance(); | |
var name = $(this).attr("name"); | |
var $form = $(this).parents('form'); | |
if (!$form.find(':radio[name="' + name + '"]:checked').length) { | |
var prefix = (sisyphus.options.locationBased ? sisyphus.href : "") + $form.attr("id") + $form.attr("name") + name + sisyphus.options.customKeySuffix; | |
sisyphus.saveToBrowserStorage(prefix, '', false); |
This file contains 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 | |
# Switch PulseAudio master channel between multiple sound cards | |
ENABLED=$(pacmd list-sinks | grep -A1 '* index' | grep 'name' | awk '{print $2}' | tr -d '<->') | |
DEVICE=$(pacmd list-sinks | grep 'name:' | awk '{print $2}' | tr -d '<->' | grep -v $ENABLED) | |
pactl set-default-sink $DEVICE | |
pactl set-default-source "$DEVICE.monitor" | |
INPUTS=($(pacmd list-sink-inputs | grep index | awk '{print $2}')) | |
for i in ${INPUTS[*]}; do pacmd move-sink-input $i $DEVICE &> /dev/null; done | |
qdbus org.kde.kmix /Mixers org.kde.KMix.MixSet.setCurrentMaster "PulseAudio::Playback_Devices=:1" "$DEVICE" 2>&1 > /dev/null |
This file contains 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
.filefield-source.filefield-source-reference { | |
float: right; | |
overflow: hidden; | |
} | |
.filefield-source.filefield-source-reference > .form-item { | |
padding: 0; | |
} |
This file contains 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 | |
# Put this file to any your local $PATH directory. | |
let n=$((`nproc` - 1)) | |
if [[ $(cpufreq-info --governors) =~ $1 ]] | |
then | |
for i in `seq 0 $n` | |
do | |
`sudo cpufreq-set -c $i -g $1` | |
done |
This file contains 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 | |
/** | |
* Implements hook_menu_alter(). | |
*/ | |
function familink_custom_menu_alter(&$items) { | |
$items['user/%user/cancel']['access callback'] = 'familink_custom_user_admin_access'; | |
$items['user/%user/cancel']['access arguments'] = array(1, 'user_cancel_access'); | |
$items['user/%user/cancel/confirm/%/%']['access callback'] = 'familink_custom_user_admin_access'; |
This file contains 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 | |
/** | |
* Implements hook_process_HOOK(). | |
*/ | |
function custom_preprocess_breadcrumb(&$variables) { | |
/** @var \Drupal\Core\Controller\TitleResolverInterface $title_resolver */ | |
$title_resolver = \Drupal::service('title_resolver'); | |
/** @var \Drupal\Core\Routing\CurrentRouteMatch $current_route */ | |
$current_route = \Drupal::service('current_route_match'); |
This file contains 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
function drush { | |
DRUSH=$(which drush) | |
PWD=$(pwd) | |
if [ -f 'drush/drushrc.php' ]; | |
then | |
$DRUSH -c ./drush/drushrc.php "$@"; | |
elif [ -d "$PWD/web" ]; | |
then | |
$DRUSH --root="$PWD/web" "$@"; | |
else |
This file contains 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/sh | |
# mandatory | |
tint2 & | |
pcmanfm -d & | |
# optional | |
# set desktop background | |
# pcmanfm --desktop & | |
nitrogen --restore & |
This file contains 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 | |
use \Drupal\user\UserInterface; | |
use \Drupal\Component\Utility\Random; | |
/** | |
* Implements hook_ENTITY_TYPE_create(). | |
*/ | |
function custom_user_user_presave(UserInterface $entity) { | |
$entity->setUsername($entity->getEmail()); | |
} |
OlderNewer