Skip to content

Instantly share code, notes, and snippets.

View matteusbarbosa's full-sized avatar
🦜
Always learning

Matteus matteusbarbosa

🦜
Always learning
View GitHub Profile
@matteusbarbosa
matteusbarbosa / img_resize.js
Created October 17, 2018 21:17 — forked from makevoid/img_resize.js
Resize Images with Canvas on the clientside
var settings = {
max_width: 600,
max_height: 200
}
resize_image = function(img){
var ctx = canvas.getContext("2d")
var canvasCopy = document.createElement("canvas")
var copyContext = canvasCopy.getContext("2d")
@joseluisq
joseluisq / 1README.md
Last active January 3, 2022 13:22
Configure PHP Lumen 5 HTTP Exception Handlers with common JSON responses.

Lumen 5 HTTP Exception Handlers with JSON support.

Configure PHP Lumen 5 HTTP Exception Handlers with common JSON responses.

image

Setup

Copy (replace) only the attached files to their respective directories. app/Exceptions/Handler.php and app/Http/Middleware/Authenticate.php

@balbuf
balbuf / wordpress-import-update.php
Created October 15, 2016 17:54
Force the WordPress importer to update existing posts instead of skipping them
<?php
/**
* When using the WordPress Importer, update existing
* posts instead of skipping them. Updates content according
* to the import file even if the existing post was updated
* more recently.
*
* To use, drop this file into your /mu-plugins/ folder or
* copy this code into your functions.php file.
@noelboss
noelboss / git-deployment.md
Last active July 16, 2024 09:50
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@natebass
natebass / remove_comment_regex.txt
Last active July 1, 2021 00:05
Remove comments from file. Credit to Lambda's answer on Stack Overflow https://stackoverflow.com/a/2613945/5178499
Remove all block comments and line comments:
(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/|[ \t]*//.*)
Remove block comments:
(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/)
Remove line comments:
([ \t]*//.*)
@lucasff
lucasff / setlocale.php
Created July 29, 2014 19:34
Force pt_BR locale in PHP
<?php
date_default_timezone_set('America/Sao_Paulo');
setlocale(LC_ALL, 'pt_BR.utf-8', 'ptb', 'pt_BR', 'portuguese-brazil', 'portuguese-brazilian', 'bra', 'brazil', 'br');
setlocale(LC_TIME, 'pt_BR.utf-8', 'ptb', 'pt_BR', 'portuguese-brazil', 'portuguese-brazilian', 'bra', 'brazil', 'br');