Skip to content

Instantly share code, notes, and snippets.

View jandrodev's full-sized avatar

jandrodev

View GitHub Profile
@jandrodev
jandrodev / gist:fba3bea5a2a19774c0a8d1f5d8be618e
Created January 17, 2023 06:42
Git - Move last pushed commit from branch a to branch b
// Move last pushed commit from branch a to branch b
git checkout b
git cherry-pick $commitHash
git push origin b
git checkout a
git rebase -i HEAD~1
git push -f origin a
@jandrodev
jandrodev / Response.php
Created May 8, 2018 12:14 — forked from jeffochoa/Response.php
Laravel HTTP status code
<?php
// This can be found in the Symfony\Component\HttpFoundation\Response class
const HTTP_CONTINUE = 100;
const HTTP_SWITCHING_PROTOCOLS = 101;
const HTTP_PROCESSING = 102; // RFC2518
const HTTP_OK = 200;
const HTTP_CREATED = 201;
const HTTP_ACCEPTED = 202;
@jandrodev
jandrodev / gist:b64f0477b197b1e1d536cfc4f170a279
Created April 9, 2018 08:18 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@jandrodev
jandrodev / xampp_php7_xdebug.md
Created February 23, 2018 13:14 — forked from odan/xampp_php7_xdebug.md
Installing Xdebug for XAMPP

Installing Xdebug for XAMPP with PHP 7.x

Requirements

Setup

@jandrodev
jandrodev / main.php
Created October 5, 2015 16:27
Borrar tabla al desactivar plugin Wordpress
function pluginUninstall() {
global $wpdb;
$table_name = $wpdb->prefix."adslzone_info";
// ¿Borrar otras opciones?
//delete_option('wp_yourplugin_version');
$wpdb->query("DROP TABLE IF EXISTS $table_name");
}
@jandrodev
jandrodev / main.php
Last active October 5, 2015 09:13
Crear tabla con insert al activar Wordpress plugin
function create_plugin_table() {
global $wpdb;
$table_name = $wpdb->prefix .'info';
if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
$query_create = 'CREATE TABLE ' . $table_name . ' (
id mediumint(9) NOT NULL AUTO_INCREMENT,
@jandrodev
jandrodev / admin.php
Created September 16, 2015 15:47
Comprobar si estamos en el primer/último elemento de un array PHP
foreach($miArray as $elem) {
if ($elem === end($miArray)) {
echo "ÚLTIMO ELEMENTO";
}
if ($elem === reset($miArray)) {
echo "PRIMER ELEMENTO";
}
@jandrodev
jandrodev / functions.php
Created August 21, 2015 07:16
Wordpress enqueue styles and scripts examples (with Angular JS)
function styles_and_scripts() {
wp_enqueue_style( 'estilos', get_bloginfo('template_directory').'/library/css/main.css' );
wp_enqueue_script( 'navigation', get_bloginfo('template_directory').'/library/js/main.js', array(), '1.0', true );
wp_enqueue_script( 'jQuery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js', array(), '1.11.0', false );
// ENQUEUE ANGULAR JS
@jandrodev
jandrodev / plugin.php
Created July 30, 2015 09:12
Basic Wordpress Post Type Creation
function create_post_type_eventos() {
register_post_type( 'eventos',
array(
'labels' => array(
'name' => __( 'Eventos' ),
'singular_name' => __( 'Eventos' ),
'all_items' => __('Todos los eventos'),
),
'public' => true,
@jandrodev
jandrodev / principal.php
Created July 7, 2015 09:45
Create Wordpress Widget with plugin
class Widget_Zona51 extends WP_Widget {
function Widget_Zona51() {
// Nombre, decsripción, etc. del widget
parent::WP_Widget(false, $name = 'Zona 51', $widget_options = array('description' => 'Acceso a la Zona 51'));
}
function widget($args, $instance) {
// Muestra el contenido del widget
echo 'Hola !';