Skip to content

Instantly share code, notes, and snippets.

View dospuntocero's full-sized avatar

Francisco arenas dospuntocero

View GitHub Profile
@dospuntocero
dospuntocero / gist:bbd8ccfd8cff725db7b9448fc74640c5
Created April 10, 2021 03:13
how to enable ubuntu over WSL with phpstorm for proper file lineendings and a decent super fast workflow
View gist:bbd8ccfd8cff725db7b9448fc74640c5
Usage
You need git to be installed for the commands below to work. Use
sudo apt install git
to do so.
Run the script and commands
git clone https://github.com/DamionGans/ubuntu-wsl2-systemd-script.git
cd ubuntu-wsl2-systemd-script/
bash ubuntu-wsl2-systemd-script.sh
@dospuntocero
dospuntocero / get_template_part wp5.5.php
Created October 5, 2020 10:50
passing parameters to wordpress's get_template_part on version 5.5+
View get_template_part wp5.5.php
//the third variable is an array where you can pass any variables or complete objects
<?php get_template_part('template-parts/featured-image',null,[
'subHead' => get_field('title_sub-head')
]); ?>
//in the part, you use the key $args to pass the parameters.
<?php if ( has_post_thumbnail( $post->ID ) ) : ?>
<section class="hero" style="background-image: url(<?php the_post_thumbnail_url(); ?>);">
<?php echo $args['subHead']; // here you pass the arguments with the variable $args?>
</section>
@dospuntocero
dospuntocero / next_prev.php
Created August 22, 2020 16:19
next prev buttons for posts or pages in wordpress
View next_prev.php
<?php
//next prev buttons
$pagelist = get_posts('sort_order=asc');//use get_pages for pages
$pages = array();
foreach ($pagelist as $page) {
$pages[] += $page->ID;
}
$current = array_search(get_the_ID(), $pages);
$prevID = $pages[$current-1];
$nextID = $pages[$current+1];
View installing rails 6 on debian
sudo apt install ruby
sudo apt install rbenv
sudo apt install ruby-railties
sudo apt install ruby-dev
sudo gem install rails -v 6.0.0
rbenv rehash
rails -v
@dospuntocero
dospuntocero / setup.php
Created May 1, 2020 21:36
remove main editor wordpress
View setup.php
add_action( 'init', function() {
remove_post_type_support( 'page', 'editor' );
}, 10);
@dospuntocero
dospuntocero / symlink.md
Created March 25, 2020 20:54
how to create a symlink in windows
View symlink.md
@dospuntocero
dospuntocero / gist:656294ac763085cba4b0b005f27a5166
Created March 7, 2020 11:01
“Parsing filters unsupported” error during extraction of RAR file - FIX Ubuntu
View gist:656294ac763085cba4b0b005f27a5166
in terminal:
sudo apt-get install unrar
or
sudo apt-get install unar
Then for using with archive manager: sudo apt-get install file-roller
@dospuntocero
dospuntocero / article.php
Created February 26, 2020 02:21
cutting the title and content for showing even smaller excerpts they they dont fit in the design
View article.php
<div class="cell medium-4">
<div class="media__teaser">
<p class="media__teaser--type">
<?php echo get_the_category()[0]->name; ?>
</p>
<div class="media__teaser--title">
<?php echo mb_strimwidth(get_the_title(), 0, 50, '...'); ?>
@dospuntocero
dospuntocero / ServerSetup.md
Last active April 22, 2020 00:03 — forked from sageworksstudio/ServerSetup.md
Ubuntu 18.04 LAMP setup
View ServerSetup.md

First create an ssh key

ssh-keygen -t rsa -C "your email"

Ubuntu 18.04 LAMP setup

SECURITY FIRST: Add a sudo user, require public key authentication and disable root login

Log into the remote machine as root: ssh root@123.45.67.890

First, add the admin user.

@dospuntocero
dospuntocero / instructions.md
Last active February 23, 2020 07:36
Running MacOS on Debian/Ubuntu/Pop_OS!
View instructions.md

If you want to experiment with a MacOS system and use GNU/Linux on your machines, then it’s actually quite simple to setup a virtual instance of MacOS on VirtualBox. Instead of looking for a Hackintosh image, I tried using a Vagrant image and was able to boot into MacOS within minutes.

  1. Prerequisites

    Install VirtualBox from VirtualBox’s download page Install additional dependencies: sudo apt-get install virtualbox-guest-utils virtualbox-guest-x11 virtualbox-guest-dkms

    Setup Vagrant by downloading the appropriate Vagrant DEB package from Vagrant’s download page

  2. Meat