Skip to content

Instantly share code, notes, and snippets.

View reinaldomendes's full-sized avatar

Reinaldo Barcelos Mendes reinaldomendes

  • Belo Horizonte MG
View GitHub Profile
@reinaldomendes
reinaldomendes / fix-header.css
Last active August 29, 2015 14:05
barra fixa quando a rolagem escondê-la
body.fixed-header .header-container{
position: fixed;
/*... Outros Css para barra fixa aqui*/
}
@reinaldomendes
reinaldomendes / Fibonacci
Last active August 29, 2015 14:06
Fibonacci Math
/**
* Fibonacci by Reinaldo Mendes.
*
*
phi ** n - psi ** n
----------------------------------
phi - psi
*/
function fibonacci(n){
@reinaldomendes
reinaldomendes / reset password
Last active August 29, 2015 14:08
Mysql Tricks
#first stop current mysql server
sudo service mysqld stop
#start mysqld_safe without grant and networking[security reason] in background
sudo mysqld_safe --skip-grant-tables --skip-networking &
#login as root
mysql -uroot
(function () {
var Multiselect = {
move: function (from, to) {
while (from.selectedIndex > -1) {
var option = from.options[from.selectedIndex];
to.appendChild(option);
}
},
moveAll: function (from, to) {
while (from.options.length > 0) {
@reinaldomendes
reinaldomendes / usar bitbucket na locaweb
Last active December 22, 2015 03:22
Truques de servidores
##################################
# ~/.ssh/config
##################################
Host bitbucket.org
Hostname altssh.bitbucket.org
Port 443
@reinaldomendes
reinaldomendes / chroot.sh
Created January 29, 2016 05:20 — forked from dorneanu/chroot.sh
Put nginx and PHP to jail using Debian 8
#!/bin/bash
# Config
N2CHROOT=~victor/tmp/n2chroot
export JAIL=/var/www/chroot
function create_chroot {
# Create devices
mkdir $JAIL/dev
mknod -m 0666 $JAIL/dev/null c 1 3
@reinaldomendes
reinaldomendes / local-register.php
Last active May 27, 2016 18:26
Magento 2 - auxiliares
<?php
#permite o desenvolvimento de módulos sem que os mesmos tenham sido instalados via composer ainda.
$composerFiles = glob(__DIR__ . "*/*/*/composer.json");
$classLoader = null;
foreach ($composerFiles as $composerFile) {
$json = json_decode(file_get_contents($composerFile), true);
if (!isset($json['autoload'])) {
throw new Exception("Autoload not found on {$composerFile}");
#
# Stop services on port 80 and 8080 before do that
#
export ARCH=amd64
export K8S_VERSION=$(curl -sS https://storage.googleapis.com/kubernetes-release/release/stable.txt)
docker run -d \
--volume=/:/rootfs:ro \
--volume=/sys:/sys:rw \
/*Define variaveis
username: admin
password: YOUR_PASSWORD_HERE
*/
set @username='admin';
set @password='YOUR_PASSWORD_HERE';
set @salt='S4Lt';
update `admin_user` set password = concat(md5(concat(@salt,@password )),':',@salt)
where username=@username;
@reinaldomendes
reinaldomendes / .php_cs
Created October 30, 2016 20:57 — forked from jatubio/.php_cs
Config file to pass PHP-CS-Fixer with Laravel 5.1 custom and PSR-2 styles coding
<?php
$finder = Symfony\Component\Finder\Finder::create()
->notPath('bootstrap/cache')
->notPath('storage')
->notPath('vendor')
->in(__DIR__)
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true);