Skip to content

Instantly share code, notes, and snippets.

@hachesilva
hachesilva / git-compare-2-branches-using-beyond-compare.sh
Created February 9, 2018 19:43
Compare 2 Git branches using Beyond Compare
# Source https://stackoverflow.com/a/39234763/1644311
git difftool -d --tool=bc3 BRANCH1 BRANCH2
var content = 'MY TEXT WITH INVISIBLE CHARS';
if (content.search(/[^\u0000-\u007E]/g) >= -1) {
content.replace(/[^\u0000-\u007E]/g, "");
this.code.set(content);
}
@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 / full-width.css
Created April 30, 2018 19:25
"Break out" of a parent's containing width to take the full screen of a page w/this nice utility class
// Source: https://twitter.com/Una/status/951519740840873984
.full-width {
width: 100vw;
position: relative;
left: 50%;
right: 50%;
margin-left: -50vw;
margin-right: -50vw;
}
// Source: https://stackoverflow.com/questions/2200494/jquery-trigger-event-when-an-element-is-removed-from-the-dom
(function($){
$.event.special.destroyed = {
remove: function(o) {
if (o.handler) {
o.handler()
}
}
}
@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 / functions.php
Created December 10, 2018 00:19
How to Automatically Remove Default Image Links in WordPress
<?php
// Source: https://www.wpbeginner.com/wp-tutorials/automatically-remove-default-image-links-wordpress/
// functions.php
function wpb_imagelink_setup() {
$image_set = get_option( 'image_default_link_type' );
if ($image_set !== 'none') {
update_option('image_default_link_type', 'none');
}
@hachesilva
hachesilva / cool-font-combos.scss
Created January 3, 2019 04:09
Cool font combinations I've found
#1 {
// Source: https://www.apres.io/
h1 {
font-family: Merriweather;
weight: 900;
font-size: 68px;
}
h2 {
font-family: Merriweather;
@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 / restart-cinnamon-in-linux-mint.txt
Created March 5, 2019 15:24
Several ways to restart Cinnamon in Linux Mint
1. Hit ctrl+alt+esc
2. Hit Alt+F2, type r, and press Enter
3. Switch to another tty, for example tty6, by pressing Ctrl+Alt+F6
Run:
pkill -HUP -f "cinnamon --replace"
Return to tty8 by pressing Ctrl+Alt+F8