Skip to content

Instantly share code, notes, and snippets.

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

Mariano Peyregne Marian0

🏠
Working from home
  • Santa Fe, Argentina
View GitHub Profile
@Marian0
Marian0 / theorem.js
Created November 24, 2019 19:21
Code challenge for Theorem job application
/**
* This function takes a multidimensional array and return a flat array by running recursively
* @param arr
* @returns {Array}
*/
const arr_flatten = (arr) => {
//empty accumulator
const flat = [];
arr.forEach(item => {
@Marian0
Marian0 / array_randomize_seed.php
Created November 14, 2015 13:02
Randomizar un array en base a una semilla
<?php
$array_loco = [];
for($i = 0; $i < 1000; $i++) {
$array_loco[] = $i;
}
mt_srand('2');
@Marian0
Marian0 / gist:556ddfdb6ddeb472cb07
Created October 24, 2015 22:15
Customize with to Collapse Bootstrap 3 navbar
@media (max-width: 1000px) {
.navbar-header {
float: none;
}
.navbar-toggle {
display: block;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
@Marian0
Marian0 / gist:4d689c33164bc9daf0e1
Created October 22, 2015 12:07
Disable wordpress Frontend by htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !/wp-admin
RewriteCond %{REQUEST_URI} !/wp-includes
RewriteCond %{REQUEST_URI} !/wp-login\.php$
RewriteCond %{REQUEST_URI} !/wp-content
RewriteCond %{REQUEST_URI} !/feed
@Marian0
Marian0 / loading.md
Last active October 16, 2015 14:05
Overlay Loading CSS

#CSS

#ajaxLoadOverlay{
    background: rgba(0, 0, 0, 0.8) url('../images/ring-alt.svg') no-repeat scroll center center;
    display: none;
    height: 100%;
    position: fixed;
    top: 0;
    width: 100%;
 z-index: 1001;
@Marian0
Marian0 / gist:f0603f4eff7bd099a356
Created March 5, 2015 16:12
Ubuntu Nautilus Files configuration Behavior
Para que el comportamiento de búsqueda sea el mismo de siempre:
gsettings set org.gnome.nautilus.preferences enable-interactive-search true
@Marian0
Marian0 / gist:069dc670f4f35dbab501
Created March 4, 2015 14:42
Capturar submit y hacer un ajax como la gente
$(document).on('submit', '#contact' , function(event) {
url = $(this).attr("action");
console.log(url);
$.ajax({
type: "POST",
url: url,
datatype: "json",
data: {
"name": $("#contact #name").val(),
@Marian0
Marian0 / gist:dac25364716861ac0b5e
Created December 19, 2014 15:22
Consulta para obtener productos con precio menor al de compra
select * from
product P,
(SELECT idProduct as prodStock, max(unitPrice) as maxPrice from buy B where stockAvailable>0 GROUP BY idProduct) L
WHERE
P.idProduct=prodStock
AND
P.unitSellingPrice<=maxPrice
;
@Marian0
Marian0 / gist:351b18f909bad9ff4074
Created December 17, 2014 16:41
CakePHP Query LOG on Controllers
$log = $this->Alerta->getDataSource()->getLog(false, false); debug($log);
@Marian0
Marian0 / gist:babab18854a651d4269a
Last active August 29, 2015 14:11
Model find example CAKE PHP
$alertasLlegando = $this->Alerta->find('all', array('conditions' => array(
'Alerta.lat >= ' => $area['lat1'],
'Alerta.lat <= ' => $area['lat2'],
'Alerta.lng <= ' => $area['lng1'],
'Alerta.lng <= ' => $area['lng2'],
'Alerta.estado' => 'llegando',
),
'limit' => 5,
'order' => array('Alerta.updated' => 'DESC')
));