Skip to content

Instantly share code, notes, and snippets.

View jjsquady's full-sized avatar
🎯
Focusing

Jorge Gonçalves Junior jjsquady

🎯
Focusing
View GitHub Profile
@jjsquady
jjsquady / nginx.vhost
Last active August 29, 2015 14:23 — forked from vedovelli/nginx.vhost
server {
listen 80;
server_name CHANGEME.app;
root /var/www/vhosts/CHANGEME.app/public;
index index.html index.htm index.php;
charset utf-8;
location / {
sudo add-apt-repository ppa:webupd8team/sublime-text-2
sudo apt-get update
sudo apt-get install sublime-text
// Classe Java para Oracle;
public class Fonetica {
public static fonetizar (String str) : String {
//Fonetiza o string recebido como parametro e devolve
//um outro string (que e o primeiro fonetizado)
str = str_upper(str); //todas as letras maiusculas
str = removePrep(str); //remove as preposições
str = removeAccentuation(str); //remove os acentos
str = removeStrange(str); //remove caracteres diferentes de
<?php
namespace App\Http\Middleware;
class HandleCorsMiddleware
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
@jjsquady
jjsquady / README.md
Created June 29, 2017 08:37 — forked from oodavid/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@jjsquady
jjsquady / fix-phantomjs.md
Created April 14, 2018 19:35 — forked from neuro-sys/fix.md
How to Fix PhantomJS to work with GhostDriver

Copy paste the line below to your terminal:

https://gist.githubusercontent.com/neuro-sys/3bf00b6cf28a93e07e44/raw/e8976da93a55e5ef7c5e8dc99c00772fffb06f6c/replacestring.c
gcc replacestring.c -oreplacestring
./replacestring "$(strings /usr/bin/phantomjs | grep "platform: ghostdriver")" " " < /usr/bin/phantomjs > phantomjs && chmod a+x phantomjs
sudo cp phantomjs /usr/bin/phantomjs

Alright, there's a bug in a recent version of PhantomJS which renders it unable to run with GhostDriver. The error is like this:

@jjsquady
jjsquady / formatar_cnpj_cpf.md
Created July 27, 2019 03:54 — forked from davidalves1/formatar_cnpj_cpf.md
Função para formatar CNPJ e CPF, disponível em PHP e JS

PHP

function formatCnpjCpf($value)
{
  $cnpj_cpf = preg_replace("/\D/", '', $value);
  
  if (strlen($cnpj_cpf) === 11) {
    return preg_replace("/(\d{3})(\d{3})(\d{3})(\d{2})/", "\$1.\$2.\$3-\$4", $cnpj_cpf);
  } 
 
@jjsquady
jjsquady / Media.blade.php
Created May 25, 2020 21:46 — forked from tanthammar/Media.blade.php
LiveWire Spatie Media Image upload with VueCroppa
<div id="media-comp" class="display-contents">
<media inline-template>
<form>
<div v-for="(image, index) in form" :key="index" @touchstart.stop @mousedown.stop class="col-span-6">
<h3 class="text-3xl font-medium">@{{ image.label }}</h3>
<p class="py-3">Allowed Width @{{image.width}}px, Height @{{image.height}}px, Max file size @{{image.maxFileSize}}</p>
<input v-model="image.value" wire:model="@{{ image.name }}" type="hidden">
<croppa v-model="image.model" :width="image.width" :height="image.height"
:placeholder="locale == 'sv' ? 'Välj en bild' : 'Choose an image'"
:accept="'image/*'" :file-size-limit="image.maxByte" :zoom-speed="3" :disable-drag-and-drop="false"
@jjsquady
jjsquady / Media.blade.php
Created May 25, 2020 21:46 — forked from tanthammar/Media.blade.php
LiveWire Spatie Media Image upload with VueCroppa
<div id="media-comp" class="display-contents">
<media inline-template>
<form>
<div v-for="(image, index) in form" :key="index" @touchstart.stop @mousedown.stop class="col-span-6">
<h3 class="text-3xl font-medium">@{{ image.label }}</h3>
<p class="py-3">Allowed Width @{{image.width}}px, Height @{{image.height}}px, Max file size @{{image.maxFileSize}}</p>
<input v-model="image.value" wire:model="@{{ image.name }}" type="hidden">
<croppa v-model="image.model" :width="image.width" :height="image.height"
:placeholder="locale == 'sv' ? 'Välj en bild' : 'Choose an image'"
:accept="'image/*'" :file-size-limit="image.maxByte" :zoom-speed="3" :disable-drag-and-drop="false"