Skip to content

Instantly share code, notes, and snippets.

View avblink's full-sized avatar

Alexander Benjamin avblink

View GitHub Profile
@avblink
avblink / Drupal8:Webforms:Ajax
Created May 1, 2017 17:10
Submit Drupal 8 webform via AJAX
<?php
function my_module_webform_submission_form_alter(array &$form, FormStateInterface $form_state, $form_id) {
if ($form['#webform_id'] == 'contact_an_expert') {
#$form['actions']['submit']['#validate'][] = 'wmp_content_types_contact_an_expert_form_validate';
$form['actions']['submit']['#ajax'] = [
'callback' => 'my_module_contact_an_expert_form_ajax',
'wrapper' => '.field--name-dynamic-block-fieldnode-contact-an-expert-form',
'type' => 'throbber',
@avblink
avblink / SEO:Crawling:UrlTitle
Last active July 6, 2017 16:14
SEO:Crawling:Get URL & Page Title
#!/bin/bash
#Domain name without trailing slash please
domain='http://local.vwt'
directories=(
'/markets'
'/applications'
'/technologies'
'/products'
@avblink
avblink / vue2-nuxt.md
Last active July 11, 2017 08:08
Vue and Nuxt related snippets

Add sass loader

npm install node-sass sass-loader --save-dev

NUXT simultaneous asynchronous data request

async asyncData({ params }) {
  let [users, posts] = await Promise.all([
 axios.get('http://jsonplaceholder.typicode.com/users'),
@avblink
avblink / Drupal8Random.md
Last active December 21, 2020 17:33
Drupal8:Random

Install specific Drupal version with composer

composer create-project drupal-composer/drupal-project:8.x-dev some-dir --stability dev --no-interaction --no-install
cd some-dir
composer require --no-update drupal/core:^8.5
composer require --no-update --dev webflo/drupal-core-require-dev:^8.5
composer install [--no-dev]

Get current URI

@avblink
avblink / App.js
Created November 30, 2017 20:43
React Native nested navigation example. Fixed header navigation with nested tab navigation.
import React, { Component } from 'react';
import {
View,
} from 'react-native';
import MyStacksOverTabs from '../config/routes';
export default class NavigationScreen extends Component {
render() {
return (
@avblink
avblink / laravel.md
Last active February 2, 2019 22:09
Laravel related

Laravel 5 file permissions:

The storage directory

Group Writable (Group, User Writable)

$ sudo chmod -R gu+w storage

World-writable (Group, User, Other Writable)

$ sudo chmod -R guo+w storage

The bootstrap/cache directory

Group Writable (Group, User Writable)
@avblink
avblink / sass-mixins.md
Last active January 17, 2019 11:26
Sass Mixins

Linear left to right gradient compatible with iOS safari

@mixin linear-gradient-ltr($fromColor, $fromStop, $toColor, $toStop) {
  background: $toColor;
  background: -moz-linear-gradient(to right, $fromColor $fromStop, $toColor $toStop);
  background: -webkit-gradient(linear, left, right, color-stop($fromStop,$fromColor), color-stop($toStop,$toColor));
  background: -webkit-linear-gradient(left, $fromColor $fromStop, $toColor $toStop); //iOS
  background: linear-gradient(to right, $fromColor $fromStop, $toColor $toStop);  //iOS
  background: -o-linear-gradient(left, $fromColor $fromStop, $toColor $toStop);
  filter: progid:DXImageTransform.Microsoft.gradient(GradientType=1, startColorstr=#{$fromColor}, endColorstr=#{$toColor});
@avblink
avblink / wp.sh
Created January 8, 2020 15:39 — forked from FeChagas/wp.sh
#!/bin/bash -e
clear
echo "============================================"
echo "Instalador de Wordpress"
echo "============================================"
echo "Host do Banco de dados: "
read -e dbhost
echo "Nome do Banco de dados: "
read -e dbname
echo "Usúario do Banco de dados: "
@avblink
avblink / xdebug.md
Last active February 18, 2021 19:34

xDebug, WSL2, Docker

Some useful commands to get xdebug running with docker on wsl2

xdebig.ini configuration:

zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so
xdebug.idekey = VSCODE