Skip to content

Instantly share code, notes, and snippets.

View csakiistvan's full-sized avatar
🏔️
happiness

Csáki István csakiistvan

🏔️
happiness
View GitHub Profile
@csakiistvan
csakiistvan / Opentime.js
Created May 22, 2019 14:48
Check the weekend and change the text in js
$(document).ready(function(){
var date = new Date()
var is_weekend = ''
if(date.getDay() == 1) {
is_weekend = "Today is closed";
} else if (date.getDay() == 2 || date.getDay() == 5) {
is_weekend = "Ma nyitva 16:00-ig";
} else {
is_weekend = "Ma nyitva 18:00-ig";
@csakiistvan
csakiistvan / mymodule.module
Created September 22, 2016 07:52
Redirect drupal user to url, if he/she has a specific role
<?php
/**
* @file
* Code for the My custom module.
*/
/**
* Implements hook_user_login().
*/
function mymodule_user_login(&$edit, $account) {
@csakiistvan
csakiistvan / template.php
Created August 16, 2016 08:28
Drupal node image field links to other link field
<?php
/**
* @file
* Preprocessing functions for event nodes.
*/
/**
* Implements hook_preprocess_node().
*/
function _[yourthemename]_preprocess_field_name__[nodetypename]__[imagefieldname](&$variables) {
@csakiistvan
csakiistvan / gist:c4502ba9efda8661d351
Created September 3, 2015 13:32
Import to sql database directly
mysql -uroot -proot dbname < filename.mysql
@csakiistvan
csakiistvan / gist:298f48633a0761f6b4b7
Created May 7, 2015 09:28
Add class all block in specified region
/**
* Implements hook_preprocess_block().
*
* @see block.tpl.php
*/
function base_theme_preprocess_block(&$variables) {
if ($variables['elements']['#block']->region == 'footer') {
$variables['classes_array'][] = 'col-xs-12 col-sm-6 col-md-3';
}
}
@csakiistvan
csakiistvan / gist:e365bebac3a41333c24f
Last active August 29, 2015 14:10
Rewrite all user email address with drush
drush sqlsan --sanitize-email=user+%uid@example.com
@csakiistvan
csakiistvan / init.sh
Created August 31, 2014 09:42
After make run shell script
#!/bin/bash
# base variables
cd $(dirname $0)/../../..
drupal_root=`pwd`
if [ "$1" == "live" ]; then
drush vset preprocess_css 0
drush vset preprocess_js 0
drush vset --exact -y install_profile newprofile
@csakiistvan
csakiistvan / theme.js
Created August 15, 2014 09:06
Enable Bootstrap 3 Hover Dropdowns.
(function ($) {
Drupal.behaviors.mytheme_name = {
attach: function (context) {
// Enable Bootstrap 3 Hover Dropdowns.
var width = $(document).width();
if (width >= 976) {
$('.dropdown-toggle').click(function() {
var location = $(this).attr('href');
window.location.href = location; return false;
});
/* iCheck plugin Flat skin, ip
----------------------------------- */
.icheckbox_flat-ip,
.iradio_flat-ip {
display: inline-block;
*display: inline;
vertical-align: middle;
margin: 0;
padding: 0;
@include iv-sprite-background();
@csakiistvan
csakiistvan / gist:42ff9250b4c9bb218601
Last active August 29, 2015 14:04
Gradient mixins
// Gradients
// Horizontal gradient, from left to right
//
// Creates two color stops, start and end, by specifying a color and position for each color stop.
// Color stops are not available in IE9 and below.
@mixin gradient-horizontal($start-color: #555, $end-color: #333, $start-percent: 0%, $end-percent: 100%) {
background-image: -webkit-linear-gradient(left, color-stop($start-color $start-percent), color-stop($end-color $end-percent)); // Safari 5.1-6, Chrome 10+