Skip to content

Instantly share code, notes, and snippets.

@hachesilva
hachesilva / settings.jsonc
Created June 12, 2023 19:00 — forked from hyperupcall/settings.jsonc
VSCode config to disable popular extensions' annoyances (telemetry, notifications, welcome pages, etc.)
// I'm tired of extensions that automatically:
// - show welcome pages / walkthroughs
// - show release notes
// - send telemetry
// - recommend things
//
// This disables all of that stuff.
// If you have more config, leave a comment so I can add it!!
{

Automating Daily Reports, because fuck it, really...

Each day at our company, developers are required to document their activities, painstakingly jotting down their daily work and future plans. A monotonous chore that I just really dislike.

So now, there's a scribe for that :

auto-dr-

Code

How to setup a practically free CDN

I've been using [Backblaze][bbz] for a while now as my online backup service. I have used a few others in the past. None were particularly satisfactory until Backblaze came along.

It was - still is - keenly priced at a flat $5 (£4) per month for unlimited backup (I've currently got just under half a terabyte backed-up). It has a fast, reliable client. The company itself is [transparent about their operations][trans] and [generous with their knowledge sharing][blog]. To me, this says they understand their customers well. I've never had reliability problems and everything about the outfit exudes a sense of simple, quick, solid quality. The service has even saved the day on a couple of occasions where I've lost files.

Safe to say, I'm a happy customer. If you're not already using Backblaze, [I highly recommend you do][recommend].

Taking on the big boys with B2

<?php
/**
* Add the code below to your theme's functions.php file
* to add a confirm password field on the register form under My Accounts.
*/
function woocommerce_registration_errors_validation($reg_errors, $sanitized_user_login, $user_email) {
global $woocommerce;
extract( $_POST );
if ( strcmp( $password, $password2 ) !== 0 ) {
@hachesilva
hachesilva / _spacing.scss
Created January 7, 2021 21:14 — forked from XanderLuciano/_spacing.scss
This is a simple sass (rather scss) recreation of a bootstrap like spacing utility which allows you to quickly and easily set margin and padding sizes through classes like `mx-3`, `p-2`, and `pt-5`. You can define spacing values in $spacing and add or remove shorthand properties with the $prefixes variable. This uses `!important` to override any…
@mixin simpleSpace {
// margin and padding values
$spacings: (
0,
.25rem,
.5rem,
1rem,
1.5rem,
2rem,
@hachesilva
hachesilva / XDebug-vscode-vagrant-bundle-setup.md
Last active May 4, 2020 09:18 — forked from sveggiani/instructions.md
[Configure XDebug, Visual Studio Code for a Vagrant VM] #debug #vm #vscode

Configure XDebug, Visual Studio Code for a Vagrant VM

1. Assumptions

  • Project (Drupal) is served on /var/www/html in the Vagrant box
  • Local project files location: c:\Users\username\Work\projects\my-project\repo\html
  • Guest machine IP is 10.0.2.2 (if this doesn't work, run route -nee in the VM and look for the gateway address)

2. Configuration

@hachesilva
hachesilva / minimal-analytics-snippet.js
Last active January 15, 2019 15:44 — forked from DavidKuennen/minimal-analytics-snippet.js
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@hachesilva
hachesilva / Contract Killer 3.md
Created September 21, 2018 16:52
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

@hachesilva
hachesilva / no-hackerrank.md
Created March 26, 2018 20:48 — forked from fasiha/no-hackerrank.md
A prospective employer invited me to do a HackerRank test. Here's my proposed alternative.

Well, that was unexpected. In the following, I’m trying to follow Jon Evans’ advice from “The Terrible Technical Interview”.


To: [email protected]
From: Ahmed Fasih
Subject: Re: Programming Test Invitation

Hi there! Thanks for offering to let me take a HackerRank test for ABC, I appreciate the vote of confidence.

@hachesilva
hachesilva / convert-integer-to-roman.php
Created September 8, 2017 18:22 — forked from edutrul/convert-integer-to-roman.php
How to convert integer to Roman number
<?php
/**
* Converts integer to Roman.
*
* @param int $integer
* Integer to be converted to Roman string.
*
* @return string
*/
public function integerToRoman($integer) {