Skip to content

Instantly share code, notes, and snippets.

# create a new branch
git checkout -b feature/example
# do some changes
# udpate master
git checkout master
git pull origin master
# rebase with master
@karrikas
karrikas / my.sql
Created August 1, 2018 13:03
Mysql - Create database and its user;
CREATE DATABASE 'my_db';
CREATE USER 'my_user'@'localhost' IDENTIFIED BY 'my_pass';
GRANT ALL PRIVILEGES ON my_db.* TO 'my_user'@'localhost';
FLUSH PRIVILEGES;
@karrikas
karrikas / Dockerfile
Last active October 31, 2018 16:10
Docker, Install wordpres cli in wordpress docker wp-cli
FROM wordpress:latest
WORKDIR /var/www/html
RUN apt-get update
RUN apt-get install -y curl \
gnupg
RUN curl -o /usr/local/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
RUN chmod +x /usr/local/bin/wp
RUN wp --info
@karrikas
karrikas / database.sql
Last active April 4, 2019 13:16
Create new database and new user in mysql
CREATE DATABASE database;
CREATE USER user@localhost IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON database.* TO user@localhost;
FLUSH PRIVILEGES;
@karrikas
karrikas / bitbucket-pipelines.yml
Created January 28, 2021 12:42
Phpunit test in Symfony proyect with bitbucket
image: docker/compose
options:
docker: true
pipelines:
default:
- step:
size: 2x # double memory (8GB) for this step
script:
@karrikas
karrikas / cp-parent.sh
Last active February 15, 2021 14:34
Copy modified files between git commits
cp -pv --parents $(git diff --name-only sha1 sha2) ../path/to/copy
@karrikas
karrikas / SymfonyCrawlerAddOptionToSelect.php
Last active February 24, 2021 10:45
Symfony Crawler how to add <option> to <select> element
<?php
use Symfony\Component\DomCrawler\Crawler;
$crawler = new Crawler('<html><body><select id="my_select"></select></body></html>');
$crawler->filter('select#my_select')->each(function (Crawler $crawler) {
$node = $crawler->getNode(0);
$option = new \DOMElement('option', 'Option Name');
$node->appendChild($option);