Skip to content

Instantly share code, notes, and snippets.

@pascalduez
pascalduez / modulename.module
Created February 22, 2012 23:33
Drupal 7 - Add a cancel button on node forms
<?php
/**
* Implements hook_form_alter().
*/
function modulename_form_alter(&$form, &$form_state, $form_id) {
// You might want to filter by content type.
if ($form_id == 'ctype_node_form') {
// Add a cancel button.
$form['actions']['cancel'] = array(
@hjortureh
hjortureh / gist:3948527
Created October 24, 2012 20:09
Responsive height
html,
body {
height: 100%;
}
@hjortureh
hjortureh / gist:3948541
Created October 24, 2012 20:12
Responsive padding
.wrapper {
width: 100%;
padding-left: 1em;
padding-right: 1em;
}
@hjortureh
hjortureh / gist:3948562
Created October 24, 2012 20:14
Responsive grid
.column {
width: 25%
float: left;
padding: 1em;
-x-box-sizing: border-box;
}
@hjortureh
hjortureh / gist:3948580
Created October 24, 2012 20:16
Responsive detect ie
<!doctype html>
<!--[if lt IE 8]><html class="oldIE"><![endif]-->
<!--[if gte IE 8]><!--><html><!--<![endif]-->
@hjortureh
hjortureh / gist:3948611
Created October 24, 2012 20:21
Responsive scaling background images
.element-with-background {
background-repeat: no-repeat;
background-position: center center;
-webkit-background-size:cover;
-moz-background-size:cover;
-o-background-size:cover;
background-size:cover;
}
@sheikhwaqas
sheikhwaqas / setup-mysql.sh
Last active April 1, 2025 18:16
Install MySQL Server on Ubuntu (Non-Interactive Installation)
# Download and Install the Latest Updates for the OS
apt-get update && apt-get upgrade -y
# Set the Server Timezone to CST
echo "America/Chicago" > /etc/timezone
dpkg-reconfigure -f noninteractive tzdata
# Enable Ubuntu Firewall and allow SSH & MySQL Ports
ufw enable
ufw allow 22
@FlYos
FlYos / 1-Readme.md
Last active April 14, 2023 21:22
Redirection user by roles after login/logout in symfony2

Description of this Gist

This is the how to for redirection implementation by roles after login or logout in Symfony2

Step

  1. Copy AfterLoginRedirection.php and AfterLogoutRedirection.php to your bundle under the "Redirection" directory
  2. Edit your services.yml file in your bundle and copy/paste the content of services.yml
  3. Edit your security.yml file...
  4. ... add success_handler: redirect.after.login in form_login: section
  5. ... add success_handler: redirect.after.logout in logout: section
@FlYos
FlYos / --Readme.md
Last active July 22, 2016 13:03
Load Magento CMS page in popin with Ajax request

Description

This module allows you to change the template pages cms backoffice defined by a particular template when we load the page through an ajax request

How to us

Create this directory structure in local pool : Webaki

  • etc -- config.xml
  • Model -- Observer.php
@illepic
illepic / file_rel_path_d8.php
Last active August 23, 2023 09:40
Get relative path for fid in Drupal 8
<?php
use Drupal\file\Entity\File;
// public://images/blah.jpg
$drupal_file_uri = File::load($fid)->getFileUri();
// /sites/default/files/images/blah.jpg
$image_path = file_url_transform_relative(file_create_url($drupal_file_uri));