Skip to content

Instantly share code, notes, and snippets.


Joaquin Bravo Contreras jackbravo

View GitHub Profile
jackbravo / Light darkish.itermcolors
Created May 20, 2020
My modification of Light Dark iterm colors
View Light darkish.itermcolors
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<key>Ansi 0 Color</key>
<key>Alpha Component</key>
<key>Blue Component</key>
jackbravo / MediaLibraryController.php
Created Nov 28, 2018
Example to launch media library with a custom input
View MediaLibraryController.php
namespace Drupal\layout_manager\Controller;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\Url;
* Controller to render basic html for client side application.
jackbravo / code_sample.php
Created Feb 22, 2018
Tell me what you see
View code_sample.php
class Document {
public $user;
public $name;
public function init($name, User $user) {
assert(strlen($name) > 5);
$this->user = $user;
$this->name = $name;
public function getTitle() {
jackbravo / anagram.php
Created Feb 22, 2018
PHP Anagram exercise
View anagram.php
# Anagram clasification
## Concepts
Anagrams are words with exactly the same letters in different order
e.g., AMOR, ROMA, and MORA
## What we need
View ExchangeRateForm.php
namespace Drupal\guia_commerce\Form;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
* Class ExchangeRateForm.
View gist:623b2aa1e6d62cb07998857b4bc393c6
### Keybase proof
I hereby claim:
* I am jackbravo on github.
* I am jackbravo ( on keybase.
* I have a public key ASCL22NAcm3VaLEnMmaKfUVUw9BkA8wUkeVnsQ1ilgwJ5Qo
To claim this, I am signing this object:
View ThemeNegotiatorInterfaceExample.php
namespace Drupal\custom_theme_helpers;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Theme\ThemeNegotiatorInterface;
* Class CustomThemeNegotiator.
* @package Drupal\bixal_theme_helpers
View update_payment.php
$type_manager = \Drupal::entityTypeManager()->getStorage('commerce_payment');
$payments = $type_manager->loadByProperties(['remote_id' => 'LTCL000016']);
$payment = reset($payments);
$payment->state = 'pending';
jackbravo /
Last active Aug 10, 2017
postgres dev start
createuser -Psd guia
createdb -O guia guia
# psql
# alter user guia with encrypted password 'guia'; -- not needed if using -P (prompt password)
# grant all privileges on database guia to guia ; -- not needed if using createdb -O (give ownership)
# alter user guia createdb ; -- not needed if using -d in createuser
jackbravo / .config_nvim_init.vim
Created Jun 20, 2017
My neovim init.vim file
View .config_nvim_init.vim
call plug#begin('~/.config/nvim/plugged')
" Polyglot loads language support on demand!
Plug 'sheerun/vim-polyglot'
Plug 'tomasr/molokai'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
let g:deoplete#enable_at_startup = 1
" use tab for completion
inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
" Execute code checks, find mistakes, in the background