Skip to content

Instantly share code, notes, and snippets.

View asterion's full-sized avatar
🌴
On vacation

Marcos Matamala Fernández asterion

🌴
On vacation
View GitHub Profile
@asterion
asterion / docker_torpedo.md
Last active August 6, 2024 14:50
docker torpedo

Ejecutar comandos con el contenedor

docker-compose run --rm [nombre] [command]

Contenedores corriendo

docker ps -a
@asterion
asterion / tiendas.txt
Last active April 26, 2018 21:02
Listado de tiendas online con productos relacionados a arduino/raspberry
http://cycom.cl/
http://electronicadelsurltda.cl/
http://kowka.cl/
http://rambal.com/
http://www.electronica.cl/productos/
http://www.hmtechtronic.cl/
http://www.hubot.cl/
http://www.maxelectronica.cl/
http://www.mcielectronics.cl/
http://www.mundoreballing.cl/
@asterion
asterion / groupby.sql
Created January 15, 2018 12:57
sql group by
SELECT facturas.id, SUM(detalle.cantidad*detalle.valor) FROM facturas, detalle WHERE facturas.id = detalle.factura_id GROUP BY facturas.id
@asterion
asterion / conn.php
Last active October 18, 2017 15:56
test_conn_sqlserver
<?php
$conn = new PDO("dblib:version=8.0;charset=UTF-8;host=IPSERVIDOR;dbname=NOMBREDB", 'USUARIO', 'PASSWORD');
$id = rand();
$query = "INSERT INTO Emp VALUES(" . $id .", 'Smith " . $id . "', 'Carpintero', 2, 300)";
$conn->query($query)->execute();
@asterion
asterion / query.php
Created July 24, 2017 22:20
prueba query_posts
<?php
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
// The Query
query_posts( 'posts_per_page=3&paged=' . $paged );
// The Loop
while ( have_posts() ) : the_post();
echo '
@asterion
asterion / permiso_wp.php
Last active July 7, 2017 18:55
otorgar permiso de subir multimedia
<?php
function allow_contrib_upload() {
$contrib = get_role( 'contributor' );
$contrib->add_cap( 'upload_files' );
}
add_action( 'admin_init', 'allow_contrib_upload', 11 );
@asterion
asterion / group_max.sql
Created July 7, 2017 01:59
group by con max
SELECT nombre, apellido, MIN(edad) AS edad FROM personas GROUP BY nombre, apellido
@asterion
asterion / envio_mail.php
Last active June 28, 2017 17:51
Envio de email usando wp, prueba.
<?php
$uploaddir = trim(ABSPATH, '/') . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR;
$attachments = [];
foreach ($_FILES as $i => $data) {
$uploadfile = $uploaddir . basename($data['name']);
if (move_uploaded_file($data['tmp_name'], $uploadfile)) {
$attachments[$i] = $uploadfile;
}
}
@asterion
asterion / db_delete.php
Last active June 27, 2017 18:08
Nadie puede poner un die en un if
<?php
$cod_item = limpiar($_POST['cod_item']);
$sql = "SELECT * FROM content WHERE code = '$cod_item'";
$result = $con->query($sql) or die ($con->error);
if ($result->num_rows > 0) {
}
@asterion
asterion / update_siteurl.sql
Created June 26, 2017 22:02
cambiar home y siteurl options de wp
update wp_options set option_value = '<aqui debe ir la url/ip>' where option_name = 'home' or option_name = 'siteurl';