Skip to content

Instantly share code, notes, and snippets.

@brianshumate
brianshumate / docker-macos-terraform.md
Last active April 16, 2024 02:18
The Simplest Terraform with Docker on macOS

If you'd like to experiment with Terraform on macOS locally, a great provider for doing so is the Docker provider. You can get set up in a few simple steps, like so:

1. Install Docker

Install Docker for Mac if you have not already.

@maynagashev
maynagashev / spacing-.css
Last active February 7, 2018 16:43
Bootstrap 4 spacing
/* top */
.p-t-0 { padding-top: 0px; }
.p-t-1 { padding-top: 10px; }
.p-t-2 { padding-top: 15px; }
.p-t-3 { padding-top: 30px; }
/* bottom */
.p-b-0 { padding-bottom: 0px; }
.p-b-1 { padding-bottom: 10px; }
.p-b-2 { padding-bottom: 15px; }
@nickwanhere
nickwanhere / gist:85bfbe8143ded6a30acb
Created October 27, 2015 08:29
Programmatically set magento locale
<?php
$locale = 'nl_NL';
Mage::app()->getLocale()->setLocaleCode($locale);
Mage::getSingleton('core/translate')->setLocale($locale)->init('frontend', true);
//http://www.kennydeckers.com/programatically-set-locale-language-magento/
?>
@voxxit
voxxit / USING-VAULT.md
Last active July 7, 2022 03:02
Consul + Vault + MySQL = <3
git clone https://gist.github.com/dd6f95398c1bdc9f1038.git vault
cd vault
docker-compose up -d
export VAULT_ADDR=http://192.168.99.100:8200

Initializing a vault:

vault init
@kandran
kandran / README.md
Last active November 19, 2018 08:28
Use php-cs-fixer with phpstorm file watcher

Auto use php-cs-fixer at save with PHPStorm and file watcher

  1. Open settings ( ctrl + alt + s)
  2. Menu file watchers
  3. Import watchers.xml
  4. Change settings like path for php and php-cs-fixer
  5. Enjoy ! PSRize at save.

NB: File watchers are linked to a specific project, so we have to re-import them for each project. External tools have IDE scope but we couldn't run them automaticaly - we could set a key bind.

@matt-bailey
matt-bailey / magento-notifications.html
Last active September 14, 2017 07:43
Magento notification markup
<ul class="messages">
<li class="error-msg">
<ul>
<li><span>Error Message</span></li>
</ul>
</li>
<li class="success-msg">
<ul>
<li><span>Success Message</span></li>
</ul>
@mmasashi
mmasashi / exit_code_matches.rb
Last active May 26, 2020 19:43 — forked from stevenharman/exit_code_matches.rb
Exit code matcher for rspec 3
RSpec::Matchers.define :terminate do |code|
actual = nil
def supports_block_expectations?
true
end
match do |block|
begin
block.call
@moertel
moertel / suppress_ruby_output.rb
Last active March 21, 2024 08:54
Temporarily suppress STDOUT and STDERR (ruby)
# Temporarily redirects STDOUT and STDERR to /dev/null
# but does print exceptions should there occur any.
# Call as:
# suppress_output { puts 'never printed' }
#
def suppress_output
original_stderr = $stderr.clone
original_stdout = $stdout.clone
$stderr.reopen(File.new('/dev/null', 'w'))
$stdout.reopen(File.new('/dev/null', 'w'))
@cjthompson
cjthompson / RobustPDO.php
Created February 3, 2014 19:52
Extended PDO class that detects dropped connections and reconnects
<?php
class RobustPDO extends PDO
{
/** Call setAttribute to set the session wait_timeout value */
const ATTR_MYSQL_TIMEOUT = 100;
/** @var array */
protected $config = [];
/** @var bool For lazy connection tracking */
@samsamm777
samsamm777 / gist:7230159
Last active April 26, 2024 13:24
PHP set private property value using reflection. This allows you to set a private property value from outside the object, great for PHPUnit testing.
<?php
$a = new A();
$reflection = new \ReflectionClass($a);
$property = $reflection->getProperty('privateProperty');
$property->setAccessible(true);
$property->setValue($a, 'new-value');
echo $a->getPrivateProperty();
//outputs: