Skip to content

Instantly share code, notes, and snippets.

View peiris's full-sized avatar
🍃

Kasun Peiris peiris

🍃
View GitHub Profile
@peiris
peiris / openssl_encrypt_decrypt.php
Created September 13, 2018 19:32 — forked from joashp/openssl_encrypt_decrypt.php
Simple PHP encrypt and decrypt using OpenSSL
<?php
/**
* simple method to encrypt or decrypt a plain text string
* initialization vector(IV) has to be the same when encrypting and decrypting
*
* @param string $action: can be 'encrypt' or 'decrypt'
* @param string $string: string to encrypt or decrypt
*
* @return string
*/
@peiris
peiris / php-best-pratices.md
Created September 13, 2018 19:19
PHP Best Practices

PHP Best Practices

Principles and rules

All code must follow:

  • Clean Code by Uncle Bob.
  • DRY, KISS and SOLID.
  • Continuous refactor. If you edit a method clean it: Boy scout rule.
@peiris
peiris / AES-256 encryption and decryption in PHP and C#.md
Created September 13, 2018 19:18
AES-256 encryption and decryption in PHP and C#

AES-256 encryption and decryption in PHP and C#

Update: There is a more secure version available. Details

PHP

<?php

$plaintext = 'My secret message 1234';
@peiris
peiris / modal-layout.blade.php
Created August 22, 2018 13:32 — forked from webinfinita/modal-layout.blade.php
Bootstrap modal blade partial view for Laravel
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">Titulo</h4>
</div>
<div class="modal-body">
Contenido
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
<button type="submit" class="btn btn-primary">Actualizar</button>