Skip to content

Instantly share code, notes, and snippets.

View nicaralava's full-sized avatar

Jean Nica Ralava nicaralava

View GitHub Profile
@nicaralava
nicaralava / index.php
Created April 25, 2019 12:18
Drupal 8 maintenace page Index
<?php
/**
* @file
* The PHP page that serves all page requests on a Drupal installation.
*
* All Drupal code is released under the GNU General Public License.
* See COPYRIGHT.txt and LICENSE.txt files in the "core" directory.
*/
@nicaralava
nicaralava / index.html
Last active April 25, 2019 12:22
Site en maintenance
<!DOCTYPE html>
<html>
<head>
<title>Site en Maintenance</title>
<style>
body {
text-align: center;
padding: 200px;
background-color: #f7f7f7
}
@nicaralava
nicaralava / slick.js
Created September 23, 2018 09:04
Slick default config
$(document).on('ready', function() {
$(".lazy").slick({
arrows: true,
dots: true,
slidesToShow: 1,
slidesToScroll: 1,
infinite: true,
autoplay: true,
autoplaySpeed: 2000,
lazyLoad: 'ondemand',
@nicaralava
nicaralava / speardOperator.js
Created August 17, 2018 12:16
ES6: Use the Spread Operator to Evaluate Arrays In-Place
const arr1 = ['JAN', 'FEB', 'MAR', 'APR', 'MAY'];
let arr2;
(function() {
"use strict";
arr2 = [...arr1]; // change this line
})();
console.log(arr2);
@nicaralava
nicaralava / _vars.scss
Created August 17, 2018 07:57
_vars.scss example in sass
/* Vars */
/* Fonts Sizes */
$base-font-size : 16px;
/**
* Raw colors
*/
$c-black : #000;
<?php
/** Implement Hook_drush_command **/
function module_name_all_export_drush_command() {
$items = array();
$items['krug-export-all-user'] = array(
'description' => "Export Krug User",
'aliases' => array(),
'callback' => 'userExportByDrush',
);
return $items;
@nicaralava
nicaralava / DrupalExportUser.php
Last active August 17, 2018 07:41
Drupal customize User Export by Drush
<?php
function UserWithTokenExport(){
$query = db_select('users','u');
$query->leftjoin('field_data_field_civility', 'user_civility', 'u.uid = user_civility.entity_id');
$query->leftjoin('field_data_field_first_name', 'first_name', 'u.uid = first_name.entity_id');
$query->leftjoin('field_data_field_last_name', 'last_name', 'u.uid = last_name.entity_id');
$query->leftjoin('field_data_field_date_of_birth', 'date_of_birth', 'u.uid = date_of_birth.entity_id');
$query->leftjoin('field_data_field_mobile_phone', 'mobile_phone', 'u.uid = mobile_phone.entity_id');
$query->leftjoin('field_data_field_user_address', 'user_address', 'u.uid = user_address.entity_id');
$query->leftjoin('field_data_field_zip_code', 'zip_code', 'u.uid = zip_code.entity_id');
@nicaralava
nicaralava / drupalredirection.php
Created August 17, 2018 07:24
Drupal custom Redirection
<?php
/**
Redirection if 404
(Page|to|type)
Ex :
node/1234|front|301
node/1234|node/321|302
**/
function redirectNode404ToAnotherPage(){
$dataList = array();
@nicaralava
nicaralava / drupalOgTag.php
Created August 17, 2018 07:19
Drupal add OGTag
<?php
/** Function OGTAG **/
function classic_ogtag ($title,$description,$image){
$html_head_title = array(
/*'meta_title' => array(
'#tag' => 'title',
'#value' => !empty($title) ? $title." | Krug" : "Krug Stories | Krug",
),*/
'meta_fb_api_id' => array(
'#tag' => 'meta',
@nicaralava
nicaralava / isObject.php
Created August 17, 2018 07:16
Check if it's an Object
<?php
/** Check if it's an Object **/
function checkIsObject($object,$method_name ){
if(isset($object)){
if(is_object($object)){
$methodeExiste = method_exists($object,$method_name);
if($methodeExiste){
return true;
}else{
return false;