Skip to content

Instantly share code, notes, and snippets.


Kevin kevinquillen

View GitHub Profile
chriscalip /
Last active Mar 6, 2019
Demo of `drush-update-assets-via-csv`
* Command callback. drush update-assets-via-csv
function drush_capacitype_deploy_update_assets_via_csv() {
$source_csv = (!is_null(drush_get_option('csv'))) ? drush_get_option('csv') : '';
if (empty($source_csv)) {
drush_print_r('Expected parameter, csv not found.');
florentdestremau / NewPasswordType.php
Last active Oct 6, 2022
A simple User authentication setup to copy & paste into your Symfony 3.4 install
View NewPasswordType.php
namespace AppBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
taufek / pre-push
Last active Oct 31, 2022
PrePush Git Hook with PhpCs and PhpStan
View pre-push
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
# To enable this hook, rename this file to "pre-commit".
exec < /dev/tty
svetlio / SerializerCount.php
Last active Feb 12, 2020
Drupal 8 views rest with pager data
View SerializerCount.php
// thanks Dan -
/** @file
* Contains \Drupal\views_ext\Plugin\views\style\SerializerCount.
namespace Drupal\views_ext\Plugin\views\style;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheableDependencyInterface;
lxhunter /
Last active Jul 8, 2022
Automated semantic versioning for travis-ci or any other ci
export SEMVER_LAST_TAG=$(git describe --abbrev=0 --tags 2>/dev/null)
export SEMVER_RELEASE_LEVEL=$(git log --oneline -1 --pretty=%B | cat | tr -d '\n' | cut -d "[" -f2 | cut -d "]" -f1)
#curl -o /tmp/hub.tgz
#tar -xvzf /tmp/hub.tgz -C /tmp
if [ -z $SEMVER_LAST_TAG ]; then
>&2 echo "No tags defined"
crittermike / get_node_by_path.php
Created Sep 16, 2016 — forked from thagler/get_node_by_path.php
Drupal 8 Get node ID by path alias
View get_node_by_path.php
$path = \Drupal::service('path.alias_manager')->getPathByAlias('/this-is-the-alias');
if(preg_match('/node\/(\d+)/', $path, $matches)) {
$node = \Drupal\node\Entity\Node::load($matches[1]);
View addressmappings.yml
plugin: default_value
default_value: US
plugin: default_value
default_value: en
'field_address/address_line1': streetAddress
'field_address/locality': city
# This has the form US-IN.
subfuzion /
Last active Dec 2, 2022
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

kevinquillen / module.php
Last active Jul 10, 2017
Importing to a SQL table from a CSV file in Drupal, so you don't have to parse exceptionally large CSVs line by line and instead can do so with MySQL querying. This snippet assumes you have read the column headers already from the CSV and passed them as parameters, as well as the temp table name you want to use.
View module.php
* Creates a temporary table to hold values from an uploaded CSV.
* @param $table_name
* @param $columns
* @param $message
* @param $context
function csv_import_create_temp_table($table_name, $columns) {