Skip to content

Instantly share code, notes, and snippets.

Avatar

Marcos Matamala Fernández asterion

View GitHub Profile
@asterion
asterion / magento.sh
Last active Sep 17, 2020
magento install
View magento.sh
php bin/magento setup:install \
--admin-firstname=Marcos \
--admin-lastname=Matamala \
--admin-email=mmatamala1982@gmail.com \
--admin-user=admin \
--admin-password='MMatamala123' \
--base-url=http://prueba.ecomsur.marcosmatamala \
--base-url-secure=https://prueba.ecomsur.marcosmatamala \
--backend-frontname=admin_demo \
--db-host=mysql-mmatamala \
View php
public function add_instagram_profile(){
$filename = sprintf('/tmp/profile.clapesuc.%s.json', date('Ymd'));
if (file_exists($filename)) {
$json = json_decode(file_get_contents($filename));
} else {
$url = 'https://api.instagram.com/v1/users/'.$this->instagram_uid.'?access_token='.$this->instagram_token;
$text = file_get_contents($url);
$json = json_decode($text);
@asterion
asterion / tiendas.txt
Last active Apr 26, 2018
Listado de tiendas online con productos relacionados a arduino/raspberry
View tiendas.txt
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/
View groupby.sql
SELECT facturas.id, SUM(detalle.cantidad*detalle.valor) FROM facturas, detalle WHERE facturas.id = detalle.factura_id GROUP BY facturas.id
View query_string.html
<link rel="stylesheet" type="text/css" href="mystyle.css?v=100">
@asterion
asterion / functions.php
Created Oct 30, 2017
upload svg wordpress
View functions.php
<?php
/* codigo ... */
function svg_mime_type($mime_types){
$mime_types['svg'] = 'image/svg+xml';
return $mime_types;
}
add_filter('upload_mimes', 'svg_mime_type', 1, 1);
@asterion
asterion / conn.php
Last active Oct 18, 2017
test_conn_sqlserver
View conn.php
<?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 Jul 24, 2017
prueba query_posts
View query.php
<?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 Jul 7, 2017
otorgar permiso de subir multimedia
View permiso_wp.php
<?php
function allow_contrib_upload() {
$contrib = get_role( 'contributor' );
$contrib->add_cap( 'upload_files' );
}
add_action( 'admin_init', 'allow_contrib_upload', 11 );
View group_max.sql
SELECT nombre, apellido, MIN(edad) AS edad FROM personas GROUP BY nombre, apellido
You can’t perform that action at this time.