Skip to content

Instantly share code, notes, and snippets.

@edysmp
edysmp / step.php
Created March 17, 2022 00:50
I fill in the date field behat step definition
/**
* @Then I fill in the date field :field with :date
*
* Assign the specified date to the element.
*/
public function iFillDateField($field, $date): void {
$field_label = $this->getSession()->getPage()->find('xpath', "//*[text() = '$field']");
if ($field_label == NULL | !$field_label->hasClass('form-item__label')) {
throw new ExpectationException('Could not find date field with label: ' . $field, $this->getSession());
}
@edysmp
edysmp / .bash_aliases
Last active September 5, 2023 03:52
DDEV and onther bash aliases.
#ALIASES
alias desc="ddev describe"
alias start="ddev start"
alias stop="ddev stop"
alias i="ddev composer install"
alias r="ddev composer require"
alias ws="ddev drush ws"
alias uli="ddev drush uli"
alias cex="ddev drush cex"
alias cim="ddev drush cim"
@edysmp
edysmp / git prompt
Last active September 4, 2023 20:32
Edys' custom bash prompt
HOST:
source /usr/lib/git-core/git-sh-prompt
export PS1='\e[0;30m\e[106m\u \w\e[0;36m\e[40m$(__git_ps1 " (%s)")\e[m\n\$ '
WEB CONTAINER:
export PS1='\e[0;30m\e[47m\u \w\e\e[m\n$ '
@edysmp
edysmp / clone-search-index.php
Created February 28, 2020 03:45
Clone search api index
$index = search_api_index_load('default_node_index');
unset($index->id);
$index->name = 'My Index';
$index->machine_name = 'my_index';
$index->save();
@edysmp
edysmp / gist:5101b879c4f0ba31474d53982b134a51
Last active May 8, 2019 22:59
Noche de alabanza Mayo10
El primer periodo:
1) Bienvenido
2) Gracia sublime
3) Cielo y tierra
4) De Gloria en Gloria
5) Fiesta
Segundo:
1) Desciende
2) Increíble
@edysmp
edysmp / app.js
Created May 15, 2018 18:13
NodeJS - Create a video streaming server
const express = require('express');
const fs = require('fs');
const app = express();
app.get('/video', function(req, res) {
const path = '/your/path/to/video-file.mp4';
const stat = fs.statSync(path)
const fileSize = stat.size
const range = req.headers.range
if (range) {
curl -sS https://ftp.drupal.org/files/projects/drupal-8.6.x-dev.zip --output drupal-8.6.x-dev.zip
unzip drupal-8.6.x-dev.zip
cd drupal-8.6.x-dev
curl https://www.drupal.org/files/issues/2018-03-23/2911319-2-157.patch | patch -p1
php core/scripts/quick-start.php
select `demo_umami` profile :)
enjoy :)
id: migrate_levels
migration_tags:
- CSV
source:
plugin: csv # <----
path: public://data.csv
header_row_count: 1
keys:
- level
column_names:
@edysmp
edysmp / gist:24f0a13c3d4834dbe514
Last active January 22, 2016 17:09
lookupDestinationId
/**
* Retrieves the hash of the source identifier values.
*
* @param array $source_id_values
* The source identifiers
*
* @return string
* An hash containing the hashed values of the source identifiers.
*/
protected function getSourceIDsHash(array $source_id_values) {