Skip to content

Instantly share code, notes, and snippets.

View malkafly's full-sized avatar
🏠
Working from home

d. malk malkafly

🏠
Working from home
View GitHub Profile
@malkafly
malkafly / group-objects-by-property.md
Created March 27, 2020 19:24 — forked from JamieMason/group-objects-by-property.md
Group Array of JavaScript Objects by Key or Property Value

Group Array of JavaScript Objects by Key or Property Value

Implementation

const groupBy = key => array =>
  array.reduce((objectsByKeyValue, obj) => {
    const value = obj[key];
    objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
    return objectsByKeyValue;
@malkafly
malkafly / index.markdown
Created March 17, 2020 20:01
Integrações RD Station - PHP

Integrações RD Station

PHP

Muitos sites em PHP possuem uma página que é um script para enviar o email de contato ou tratar o preenchimento de algum formulário.

Para fazer com que essa página envie os dados para o CRM do RD Station, é só inserir nosso script de integração em seu código e fazer a chamada quando for controlar a submissão dos dados.

Script para integração

@malkafly
malkafly / seller.php
Created April 8, 2019 16:56
Integração rápida com a Zoop
<?php
namespace App\Zoop;
use Auth;
use Carbon\Carbon;
use App\Zoop\ZoopGateway;
class Seller extends ZoopGateway
{
@malkafly
malkafly / calculadora.html
Created April 8, 2019 14:22
calculadora arquitecasa
<h3>Comece já sua obra gratuitamente</h3>
<form action="https://app.arquitecasa.com.br/simular" method="get" class="search-pros-form">
<div class="field-group">
<label>O que você precisa</label><br>
<select name="type">
<option value="reformar">Reformar</option>
<option value="construir">Construir</option>
</select>
</div>
<div class="field-group">
@malkafly
malkafly / banks.php
Created March 6, 2019 07:35
Bancos e Códigos de cada banco em Array - PHP
public $banks = [
'237' => '237 - Banco Bradesco S.A.',
'001' => '001 - Banco do Brasil S.A.',
'341' => '341 - Itaú Unibanco S.A.',
'033' => '033 - Banco Santander (Brasil) S.A.',
'104' => '104 - Caixa Econômica Federal',
'654' => '654 - Banco A.J.Renner S.A.',
'246' => '246 - Banco ABC Brasil S.A.',
'075' => '075 - Banco ABN AMRO S.A.',
'025' => '025 - Banco Alfa S.A.',
@malkafly
malkafly / update.php
Created February 5, 2019 00:55
update wordpress url
<?php
$link = mysqli_connect("localhost", "user", "password", "database");
if($link === false){
die("ERROR: Could not connect. " . mysqli_connect_error());
}
$sql = "UPDATE wp_options SET option_value = replace(option_value, 'http://oldserver.com.br', 'http://newserver.com.br') WHERE option_name = 'home' OR option_name = 'siteurl';";
if(mysqli_query($link, $sql)){
echo "feito.";
} else {
@malkafly
malkafly / extensions.sh
Created January 15, 2019 19:51
Visual Studio Code
code --install-extension alefragnani.Bookmarks
code --install-extension brapifra.phpserver
code --install-extension CoenraadS.bracket-pair-colorizer
code --install-extension donjayamanne.githistory
code --install-extension formulahendry.auto-close-tag
code --install-extension formulahendry.auto-rename-tag
code --install-extension HookyQR.beautify
code --install-extension HvyIndustries.crane
code --install-extension octref.vetur
code --install-extension oderwat.indent-rainbow
@malkafly
malkafly / laravel-permissions
Created January 8, 2019 22:13
Laravel Directory Permissions - run on root of your application
sudo chown -R www-data:www-data .
sudo usermod -a -G www-data admin
sudo find . -type f -exec chmod 644 {} \;
sudo find . -type d -exec chmod 755 {} \;
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
@malkafly
malkafly / laravel-permissions
Created January 8, 2019 22:13
Laravel Directory Permissions
sudo chown -R www-data:www-data .
sudo usermod -a -G www-data admin
sudo find . -type f -exec chmod 644 {} \;
sudo find . -type d -exec chmod 755 {} \;
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
@malkafly
malkafly / teste.json
Last active December 14, 2018 16:43
teste api xp
{"swagger": "2.0","info": { "version": "2018.11.6.114634","title": "SAK.Test.ApplicationLab","description": "A sample API that uses a Http2RpcProvider provider as an example to demonstrate features in SAK","license": {"name": "MIT"}},"host": "localhost:20319","basePath": "/","schemes": ["http"],"consumes": ["application/json"],"produces": ["application/json"],"paths": { "/apitestservice/v1/customers": {"get": { "operationId": "GetCustomers","summary": "Método: GetCustomers","produces": [ "application/json" ],"responses": { "200": { "description": "200 response" }}},"post": { "operationId": "PostCustomers","summary": "Método: PostCustomers","produces": [ "application/json" ],"responses": { "200": { "description": "200 response" }}}},"/apitestservice/v1/customers/:id": {"get": { "operationId": "GetSingleCustomers","summary": "Método: GetSingleCustomers","produces": [ "application/json" ],"responses": { "200": { "description": "200 response" }}},"post": { "operationId": "PostCustomersById","summary": "Método: P