Skip to content

Instantly share code, notes, and snippets.

Maykonn Welington Candido Maykonn

Block or report user

Report or block Maykonn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Maykonn
Maykonn / hierarchical_parent_id_recursive_query.sql
Last active Mar 13, 2019
[SQL] Retrieves results in a hierarchy starting from a specific register (recursive parent_id)
View hierarchical_parent_id_recursive_query.sql
/**
* Retrieves a customer group hierarchy.
* Change the @root_id value to change the hierarchy root.
*/
SET @root_id = 1;
SELECT *
FROM (
SELECT * FROM tbl
ORDER BY parent_id, id) hiearchy_sorted,
@Maykonn
Maykonn / maykonn-php-code-style.xml
Created Jan 24, 2019
PHP Code Style for PHPStorm IDE
View maykonn-php-code-style.xml
<code_scheme name="maykonn-php-code-style" version="173">
<PHPCodeStyleSettings>
<option name="CONCAT_SPACES" value="false" />
</PHPCodeStyleSettings>
<codeStyleSettings language="PHP">
<option name="SPACE_AFTER_TYPE_CAST" value="true" />
</codeStyleSettings>
</code_scheme>
@Maykonn
Maykonn / check-if-service-is-running.sh
Last active Jan 24, 2019
This gist is a .sh file which test if a service is running, you may change as necessary for your needs
View check-if-service-is-running.sh
#!/bin/bash
local_mysql_service=mysql
if (( $(ps -ef | grep -v grep | grep ${local_mysql_service} | wc -l) > 0 ))
then
service ${local_mysql_service} stop
fi
echo "Conflicting local services stopped ($local_mysql_service), continue..."
local_apache_service=apache2
@Maykonn
Maykonn / Maykonn-Symfony-4-Code-Style.xml
Created Aug 9, 2018
PHP Code Style for PHPStorm IDE based on Symfony 4 Skeleton App
View Maykonn-Symfony-4-Code-Style.xml
<code_scheme name="Maykonn-Symfony-4-Code-Style" version="173">
<PHPCodeStyleSettings>
<option name="CONCAT_SPACES" value="false" />
</PHPCodeStyleSettings>
<codeStyleSettings language="PHP">
<option name="SPACE_AFTER_TYPE_CAST" value="true" />
</codeStyleSettings>
</code_scheme>
@Maykonn
Maykonn / sql-redshift-mysql-postgresql-find-string-comma-separated.md
Last active Oct 22, 2018
SQL search by specific string in a comma separated string (Solution for Redshift too).
View sql-redshift-mysql-postgresql-find-string-comma-separated.md

Will return 0 or false:

SELECT "5,18,5,7,9,2" REGEXP "[[:<:]](8)[[:>:]]"

Will return 1 or true:

SELECT "5,18,5,7,9,2" REGEXP "[[:<:]](5)[[:>:]]"

For Redshift you must use ~ instead REGEXP on above statements:

@Maykonn
Maykonn / twitter-request-token.php
Created Jan 23, 2018
Twitter Integration: Backend endpoint to request token
View twitter-request-token.php
<?php
/**
* Twitter Integration: Backend endpoint to request token
*
* @author Maykonn Welington Candido<maykonn@outlook.com>
* @see https://developer.twitter.com/en/docs/basics/authentication/api-reference/request_token
*
* @uses This file must be requested by a application passing the callback_url on querystring. Response Content-Type is application/json.
* @example https://mydomain.com/twitter/request_token.php?callback_url=https://mydomain.com/path-to-redirect-after-request-token
*/
View WebRTCVideoChatUsingPeerJS.md

SIMPLE WEBRTC VIDEO CHAT USING PEERJS

Operating System Ubuntu 14.04 via Koding.com

Install node.js

sudo apt-get update
sudo apt-get install nodejs

Check node.js version

@Maykonn
Maykonn / gist:9f135e83ab27b1c9e4fc
Last active Jan 23, 2018 — forked from fernandojunior/gist:0c1bcf595c16a059fc5d
Install mysql and/or workbench on ubuntu
View gist:9f135e83ab27b1c9e4fc
# Install mysql server 5.6 on Ubuntu
apt-get install mysql-server-5.6
# Login into MySQL Server
mysql -uroot -p
# restart mysql server
sudo service mysql start|restart|stop|status
# http://sharadchhetri.com/2014/05/07/install-mysql-server-5-6-ubuntu-14-04-lts-trusty-tahr/
@Maykonn
Maykonn / how-to-enable-cors-in-laravel-5.0.md
Last active Aug 29, 2015
How to enable CORS in Laravel 5.0?
View how-to-enable-cors-in-laravel-5.0.md

Is common a [CORS][1] message when accessing a Laravel Application (or better, an Laravel API), resource via another client application (an Angular.js, Backbone.js, Ember.js, or a PHP, JS, Java, Mobile, app, whatever).

To enable CORS in your Laravel application, create a route group and put inside, all routes that you need to enable CORS:

<?php
Route::group(['after' => 'allowOrigin'], function() {
    // Your fantastic resources
    Route::post('/users', function () {  // ... });
    // ...
});
View currency_symbols.php
<?php
$currency_symbols = array(
'AED' => '&#1583;.&#1573;', // ?
'AFN' => '&#65;&#102;',
'ALL' => '&#76;&#101;&#107;',
'AMD' => '',
'ANG' => '&#402;',
'AOA' => '&#75;&#122;', // ?
'ARS' => '&#36;',
'AUD' => '&#36;',
You can’t perform that action at this time.