Skip to content

Instantly share code, notes, and snippets.

View luizbills's full-sized avatar

Luiz Bills luizbills

View GitHub Profile
@franciscocpg
franciscocpg / README.md
Last active July 18, 2023 12:56
How to move the default /var/lib/docker to another directory for Docker on Linux

Take note that you can use this approach to move the /var/lib/docker directory to another disk or partition. Just make sure you create the destination directory in this new disk or partition.

  • Stop the server:
sudo systemctl stop docker
  • Create/edit the configuration at /etc/docker/daemon.json, for example:
{
@claudiosanches
claudiosanches / svn-checkout.sh
Last active July 4, 2022 18:32
SVN - Checkout project and don't fetch content for all tags
svn co --depth=files https://plugins.svn.wordpress.org/woocommerce/ # Checkout project without fetching content
cd woocommerce
svn up assets branches trunk # Fetch content for everything except for the tags
svn up --set-depth=immediates tags # Create tags directory tree, but don't fetch any content
svn up --set-depth=infinity tags/<tag_number> # Fetch content for a tag
@xem
xem / JSGameFramework2020.html
Last active November 11, 2023 19:53
JS game framework 2020
<body style=margin:0>
<canvas id=a>
<script>
// initialize 2D canvas (c)
// initialize game state (s)
// initialize keys states (u,r,d,l for directions, k for all the keyboard)
c=a.getContext`2d`,k=[u=r=d=l=s=0]
// (initialize your global variables here)
// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var elements = document.body.getElementsByTagName('*');
var items = [];
for (var i = 0; i < elements.length; i++) {
if (elements[i].innerHTML.indexOf('* { background:#000!important;color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }') != -1) {
items.push(elements[i]);
}
}
@developit
developit / *valoo.md
Last active November 13, 2023 08:39
🐻 Valoo: just the bare necessities of state management. 150b / 120b. https://npm.im/valoo

🐻 valoo

just the bare necessities of state management.

Usage

Hotlink it from https://unpkg.com/valoo.

See Interactive Codepen Demo.

@maxivak
maxivak / __upload_file.md
Last active April 4, 2024 10:07
PHP upload file with curl (multipart/form-data)

We want to upload file to a server with POST HTTP request. We will use curl functions.


// data fields for POST request
$fields = array("f1"=>"value1", "another_field2"=>"anothervalue");

// files to upload
$filenames = array("/tmp/1.jpg", "/tmp/2.png");
@felipemarcos
felipemarcos / wp-cpf-login.php
Last active July 3, 2023 15:12
Permitir login por CPF - WordPress
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Plugin Name: Login por CPF
* Description: Permite o usuário se logar utilizando o CPF.
* Author: Felipe Marcos
* Author URI: https://felipe.zip
* License: GNU General Public License v3 or later
@bekarice
bekarice / filter-wc-orders-by-gateway.php
Last active August 3, 2023 13:37
Filters WooCommerce Orders by Payment Gateway Used
<?php
/**
* Plugin Name: Filter WooCommerce Orders by Payment Method
* Plugin URI: http://skyverge.com/
* Description: Filters WooCommerce orders by the payment method used :)
* Author: SkyVerge
* Author URI: http://www.skyverge.com/
* Version: 1.0.0
* Text Domain: wc-filter-orders-by-payment
*
<?php
/**
* Client wants only logged in users to see prices and buy non-sale items while allowing all users to see prices and buy
* on sale items
*/
/**
*
* filters woocommerce_is_purchasable for not onsale items
*
@davidwilliamdacosta
davidwilliamdacosta / exibir-produtos-sem-estoque-final-pagina.php
Created December 7, 2016 13:10
Exibir produtos sem estoque final da pagina Woocommerce
<?php
/**
* Order product collections by stock status, instock products first.
*/
class iWC_Orderby_Stock_Status
{
public function __construct()
{