Skip to content

Instantly share code, notes, and snippets.

View nachoaguirre's full-sized avatar

Ignacio Aguirre nachoaguirre

  • Santiago, Chile
View GitHub Profile
@nachoaguirre
nachoaguirre / Error -96760.txt
Last active November 3, 2019 21:32
Reparar discos MacOS. Error -96760. No se pudo escribir en el último bloque del dispositivo.txt
diskutil eraseDisk JHFS+ nombre /dev/disk#
Started erase on disk#
Unmounting disk
Error: -69760: Unable to write to the last block of the device
->
fdisk -i /dev/disk#
diskutil umountDisk /dev/disk#
@nachoaguirre
nachoaguirre / breakpoints.html
Last active December 10, 2019 03:36
mostrar bootstrap breakpoint
<div class="my-5">
Breakpoint actual:
<span class="badge badge-primary d-inline d-sm-none">xs</span>
<span class="badge badge-primary d-none d-sm-inline d-md-none">sm</span>
<span class="badge badge-primary d-none d-md-inline d-lg-none">md</span>
<span class="badge badge-primary d-none d-lg-inline d-xl-none">lg</span>
<span class="badge badge-primary d-none d-xl-inline">xl</span>
</div>
@nachoaguirre
nachoaguirre / calcular_boleta.js
Created December 5, 2019 06:09
Calculo para emitir boleta chile
<script>
// Calculo para hacer la boleta: [valor_a_recibir]*1.1111111111111112
var montoLiquido = 660000;
var impuesto = (montoLiquido*1.1111111111111112)-montoLiquido;
var montoBoleta = montoLiquido*1.1111111111111112;
document.write("Monto a recibir: $"+montoLiquido);
document.write("<br />");
document.write("Impuesto: $"+parseInt(impuesto));
@nachoaguirre
nachoaguirre / Database.php
Created December 10, 2019 03:35
codeigniter 4 mamp mysql socket
public $default = [
'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',
'DSN' => '',
'hostname' => '127.0.0.1',
'username' => 'root',
'password' => 'root',
'database' => 'XXX',
'DBDriver' => 'MySQLi',
'DBPrefix' => '',
'pConnect' => false,

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@nachoaguirre
nachoaguirre / Log-.md
Created January 8, 2021 04:44 — forked from bgrins/Log-.md
Prevent errors on console methods when no console present and expose a global 'log' function.

Javascript log Function

Every time I start a new project, I want to pull in a log function that allows the same functionality as the console.log, including the full functionality of the Console API.

There are a lot of ways to do this, but many are lacking. A common problem with wrapper functions is that the line number that shows up next to the log is the line number of the log function itself, not where log was invoked. There are also times where the arguments get logged in a way that isn't quite the same as the native function.

This is an attempt to once and for all document the function that I pull in to new projects. There are two different options:

  • The full version: Inspired by the plugin in HTML5 Boilerplate. Use this if you are writing an application and want to create a window.log function. Additionally,
@nachoaguirre
nachoaguirre / bootstrap_helpers.js
Last active February 1, 2021 21:35
common helpers
/*
Añadir class según breakpoint al body
*/
var breakpoint = (function(body) {
let bp_cur = "";
var bp_dom = {
get: function (o) { var obj = Object.create(this); obj.element = (typeof o == "object") ? o : document.createElement(o); return obj; },
app: function (o) { var obj = bp_dom.get(o); this.element.prepend(obj.element); return obj; },
att: function (k, v) { this.element.setAttribute(k, v); return this; },
cls: function (c) { this.element.className = c; return this; },
@nachoaguirre
nachoaguirre / str2slug.js
Created February 7, 2021 01:48
Texto a Slug
function toSlug(str) {
str = str.replace(/^\s+|\s+$/g, '');
str = str.toLowerCase();
var from = "ãàáäâẽèéëêìíïîõòóöôùúüûñç·/_,:;";
var to = "aaaaaeeeeeiiiiooooouuuunc------";
for (var i=0, l=from.length ; i<l ; i++) { str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i)); }
str = str.replace(/[^a-z0-9 -]/g, '').replace(/\s+/g, '-').replace(/-+/g, '-'); return str;
}
// Itera sobre objeto para agregar propiedad 'slug', basandose en propiedad 'nombre'
@nachoaguirre
nachoaguirre / common_helpers.php
Created March 12, 2021 03:23
common_helpers.php
function fixPrecio($number, $showsign=true){
$showsign = !$showsign ? "" : "$";
return $showsign.number_format($number, 0, '.', '.');
}
@nachoaguirre
nachoaguirre / main.cf
Last active April 10, 2021 17:02
AWS EC2 + SES + POSTFIX SMTP Working
# CONTENIDO DEL ARCHIVO /etc/postfix/main.cf
#myorigin = /etc/mailname
biff = no
append_dot_mydomain = no
#delay_warning_time = 4h
readme_directory = no
compatibility_level = 2
# TLS parameters