This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const array = [ 'foo', 'bar', 'baz' ]; | |
// Empezando en la posición 1, elimina el siguiente elemento | |
const removedElement = array.splice( 1, 1 ); | |
// [ 'foo', 'baz' ] | |
console.log( array ); | |
// [ 'bar' ] | |
console.log( removedElement ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const array = [ 'foo', 'bar', 'baz' ]; | |
// Empezando en la posición 1, elimina los dos siguientes elementos | |
const removedElement = array.splice( 1, 2 ); | |
// [ 'foo' ] | |
console.log( array ); | |
// [ 'bar', 'baz' ] | |
console.log( removedElement ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const array = [ 'foo', 'bar', 'baz' ]; | |
// Elimina el último elemento del array | |
const removedElement = array.pop(); | |
// [ 'foo', 'bar' ] | |
console.log( array ) | |
// 'baz' | |
console.log( removedElement ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const array = [ 'foo', 'bar', 'baz' ]; | |
// Elimina el primer elemento del array | |
const removedElement = array.shift(); | |
// [ 'bar', 'baz' ] | |
console.log( array ); | |
// 'foo' | |
console.log( removedElement ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let array = [ 'foo', 'bar', 'baz' ]; | |
let removedElement; | |
// Elimina la primer instancia de 'bar' | |
if ( array.indexOf( 'bar' ) > -1 ) { | |
removedElement = array.splice( array.indexOf( 'bar' ), 1 ); | |
} | |
// [ 'foo', 'baz' ] | |
console.log( array ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const array = [ 'foo', 'bar', 'baz' ]; | |
// Regresa todo lo que no es "bar" | |
const newArray = array.filter( element => element !== 'bar' ); | |
// [ 'foo', 'baz' ] | |
console.log( newArray ); | |
// [ 'foo', 'bar', 'baz' ] | |
console.log( array ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- sitio | |
-- .gitignore | |
-- themes | |
--- nuestro-theme | |
---- style.css | |
-- plugins | |
--- nuestro-plugin | |
---- nuestro-plugin.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Asumiendo que nuestra carpeta wp-content se encuentra en /public_html/wp-content | |
$ ssh [email protected] | |
# cd /public_html | |
# mv wp-content wp-content.bk // Crea un backup de la actual carpeta wp-content en caso de necesitarla en un futuro | |
# git clone [email protected]:usuario/sitio.git wp-content // Crea una copia del repositorio en un forder llamado wp-content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Asumiendo que el trabajo ha sido completado | |
$ git checkout master | |
$ git pull origin master // Asegurarnos de que tenemos la versión más reciente | |
$ git checkout -b feature/slideshow // Movernos a un nuevo branch para no modificar producción | |
// Comienzo y fin del trabajo | |
$ git add -A | |
$ git commit -m "Implementando carrusel de imágenes" // Guardar una versión de estos archivos con las nuevas modificaciones |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ssh [email protected] // Entrar al servidor | |
# cd /staging.sitio.com/public_html/wp-content // Asegurarnos de estar en el sitio de pruebas | |
# git checkout staging // Asegurarnos de estar en el branch de pruebas | |
# git merge --no-ff feature/slideshow // Unir nuestro nuevo trabajo a nuestra rama de staging |
OlderNewer