Skip to content

Instantly share code, notes, and snippets.

View bonfil1's full-sized avatar
🏠
Working from home

Jose Angel Bonfil bonfil1

🏠
Working from home
View GitHub Profile
@fredysan
fredysan / Docksal-Mailhog-Drupal.md
Last active January 28, 2021 17:21
Configure Docksal to use Mail Hog and use it from Drupal

Configure Docksal to use Mail Hog and use it from Drupal 8

Docksal settings

# .docksal/docksal.yml

  cli:
    # Make sure that the cli image is updated.
    image: docksal/cli:2.11-php7.3
 environment:

Generate a patch from un-commited files:

git diff > file.patch

But sometimes it happens that part of the stuff you're doing are new files that are untracked and won't be in your git diff output. So, one way to do a patch is to stage everything for a new commit (but don't do the commit), and then:

git diff --cached > file.patch

Add the 'binary' option if you want to add binary files to the patch (e.g. mp3 files):

@scodx
scodx / git patches.md
Last active November 11, 2019 16:38

Git Patches

Generate a patch from un-commited files:

git diff > file.patch

But sometimes it happens that part of the stuff you're doing are new files that are untracked and won't be in your git diff output. So, one way to do a patch is to stage everything for a new commit (but don't do the commit), and then:

git diff --cached > file.patch

Add the 'binary' option if you want to add binary files to the patch (e.g. mp3 files):

@scodx
scodx / add-zeroes.md
Last active October 11, 2019 20:32
Adding 0's to a string when is lower than 10 in PHP and JS

PHP

$n = sprintf("%04d", $n)

JS

var n = ('00'+'09').slice(-2);
@JeffTomlinson
JeffTomlinson / MyService.php
Last active December 22, 2021 07:49
Drupal 8 Logger Dependency Injection
<?php
namespace Drupal\my_module\Services;
use Drupal\Core\Logger\LoggerChannelFactory;
/**
* Class MyService.
*
* @package Drupal\my_module\Services
@miguelfrias
miguelfrias / Setup-after-clean-install
Last active August 29, 2015 13:57
Setup after clean install
# Programs
Chrome (https://www.google.com/intl/en/chrome/browser/)
Skype (http://www.skype.com/en/download-skype/skype-for-computer/)
Moom [App store]
Alinof timer [App store]
# Desarrollo
Xcode [App store]
@monkeymonk
monkeymonk / .bash_profile
Last active February 8, 2023 13:04
Mac OS - BASH Configuration and Aliases (eg. `sudo nano ~/.bash_profile`)
# BASH Configuration and Aliases
# source: http://natelandau.com/my-mac-osx-bash_profile/
# source: https://github.com/mathiasbynens/dotfiles
# Sections:
# 0. Execute Only Once (if you want)
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
@oodavid
oodavid / README.md
Last active June 12, 2024 00:28 — forked from aronwoost/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@yobud
yobud / AddFulltextIndexesCommand.php
Created September 22, 2011 09:35
MATCH AGAINST for Doctrine DQL queries
<?php
# xxx/yyyBundle/Command/AddFulltextIndexesCommand.php
/**
* AddFulltextIndexesCommand.php
*
* @author Jérémy Hubert <jeremy.hubert@infogroom.fr>
* @since lun. 26 sept. 2011 09:23:53
*/
namespace xxx\yyyBundle\Command;