Skip to content

Instantly share code, notes, and snippets.

View aleckyann's full-sized avatar
🗻
scaling

Aleck Yann M. aleckyann

🗻
scaling
View GitHub Profile
@aleckyann
aleckyann / removeEvent.js
Last active January 27, 2017 18:25
removeEventListener not work
function nulo (event) {
return true;
}
if(sessionStorage.getItem('enterToSend') === 'true'){
document.getElementById('enterToSend').setAttribute('checked', true);
document.getElementById('mensagem').addEventListener('keydown', function(e) {
if(e.keyCode == 13) {
document.getElementById('enviaMensagem').click();
@aleckyann
aleckyann / aleck.js
Created January 27, 2017 18:40
now working
function onMessageClick(e) {
if(e.keyCode == 13) {
document.getElementById('enviaMensagem').click();
}
}
if(sessionStorage.getItem('enterToSend') === 'true'){
document.getElementById('enterToSend').setAttribute('checked', true);
document.getElementById('mensagem').addEventListener('keydown', onMessageClick);
} else {
@aleckyann
aleckyann / routes.php
Last active May 2, 2018 12:47
Solução para "Routes Hell" no Codeigniter.
<?php
defined('BASEPATH') OR die('404. That’s an error.');
/**
* Substitua o arquivo `application/config/routes.php` por este. (Salve suas rotas antes :D )
* Crie o diretório `application/routes`.
* Em seguida só criar quantos arquivos de rotas desejar.
* Normalmente crio um arquivo de rota para cada área do meu sistema, exemplo:
* `dashboard.php`, `perfil.php`, `login.php`, `exemplo.php`.
**/
@aleckyann
aleckyann / Password.php
Created May 1, 2018 21:26
Classe para abstrair criação de password com php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Password {
/**
* Cria o password
*/
public function create($password_input)
{
@aleckyann
aleckyann / csvHelper.php
Created May 13, 2018 23:23
Funções para ler e escrever arquivos .csv
<?php
/**
* exemplo: $array_de_arrays = array(
* array('linha1.coluna1', 'linha1.coluna2', 'linha1.coluna3'),
* array('llinha2.coluna1', 'linha2.coluna2', 'linha2.coluna3')
* );
**/
function writeCSV($local_do_arquivo, $array_de_arrays) {
$arquivo = fopen($local_do_arquivo, 'w');
@aleckyann
aleckyann / .htaccess
Created June 8, 2018 00:37
htaccess turbinado :)
#FORÇAR HTTPS E URLS AMIGÁVEIS
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
RewriteCond %{HTTP_HOST} \.
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
@aleckyann
aleckyann / php
Created July 3, 2018 04:25
gerando .csv
//EXEMPLO:
// QUERO PEGAR EQUIPAMENTOS DA TABELA EQUIPAMENTOS E GERA O .CSV :
function writeCSV($nome_do_arquivo, $array_de_arrays, $array_de_indices = array()) {
$arquivo = fopen(FCPATH.$nome_do_arquivo, 'w');
array_unshift($array_de_arrays, $array_de_indices);
foreach ($array_de_arrays as $array) {
@aleckyann
aleckyann / php
Created July 9, 2018 01:25
upload
/**
* use no form: enctype="multipart/form-data"
**/
public function insert_foto($equipamento)
{
$config['upload_path'] = FCPATH . 'public/application/equipamentos/fotos';
$config['allowed_types'] = 'jpg|png|jpeg|gif|tif';
$config['max_size'] = 1024 * 5;
@aleckyann
aleckyann / Api_controller.php
Created June 9, 2020 12:57
Usando buscas realtime Datatable e CI
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Index_controller extends Sistema_controller {
#GET: /admin/servicos/clientes/id
public function clientes_by_id()
@aleckyann
aleckyann / busjonas.html
Created August 27, 2020 14:15
Html + css for bus seat booking
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Seleção de lugares</title>
<style>
*, *:before, *:after {