Skip to content

Instantly share code, notes, and snippets.

View malitta's full-sized avatar

Malitta Nanayakkara malitta

View GitHub Profile
@malitta
malitta / EtherValidate.php
Last active August 13, 2022 21:28
Check if Ether address is valid (a PHP implementation of the Ethereum Web3 API's isAddress() method). Credits to @tormuto.
<?php
/**
* Checks if the given string is an address
*
* @param String $address the given HEX adress
* @return Boolean
*/
function isAddress($address) {
if (!preg_match('/^(0x)?[0-9a-f]{40}$/i',$address)) {
@malitta
malitta / README.md
Created October 23, 2016 06:38
Deploying Laravel project on a production server

Setting up

Make sure .env file contain the following

  • APP_URL set to the correct publicly accessible URL
  • Doesn't have the APP_ENV so app is in production mode
  • APP_DEBUG=false to disable debug mode

Updating the application

@malitta
malitta / README.md
Last active September 9, 2020 10:58
Things to do when getting started with a Laravel project

Setting up

Fresh installation

If you use composer create-project --prefer-dist laravel/laravel blog to create a Laravel project

  • chmod -R 777 storage bootstrap/cache

Clone Laravel source

@malitta
malitta / README.md
Last active October 22, 2016 19:20
Link web/db docker containers with a Laravel project

Setting up

Create the following files inside your Laravel project.

Add the following to the .gitignore file in the main project.

@malitta
malitta / gist:3898644
Created October 16, 2012 10:51
Regular Expression to remove 'contenteditable' from an element

RegExp: /contenteditable(([ ]*)?\=?([ ]*)?"(.*)")?(\=([a-z0-9]*)\s)?/gi
Pattern: contenteditable(([ ]*)?\=?([ ]*)?"(.*)")?(\=([a-z0-9]*)\s)?

http://regexr.com?32fon