Skip to content

Instantly share code, notes, and snippets.

@kevbost
kevbost / deleted_file_diff.md
Last active December 21, 2023 02:25
Shell script to run git diff against a deleted and added file after a rename
@mrbusche
mrbusche / bookmarklets.txt
Created August 24, 2022 02:20
Bookmarklets
wrap any function in
javascript: (function () {
// javascript goes here
})();
minify and then create a bookmark with the URL as the minified JavaScript
// grayscale all images without an alt tag
const css = document.createElement("style");
@eduardo-mior
eduardo-mior / disable-form-auto-complete.md
Last active July 31, 2024 11:28
How to disable HTML Input Autocomplete

Definitive guide → 6 ways to solve

I would very much like there to be a WEB standard for this, but unfortunately there is not!

I studied this for several days and gathered a lot of information and I will share it with you.

Before developing or using an internet hack you need to know that there are 2 types of Autocomplete. There is the autocomplete of the page and the autocomplete of the browser.

This is the global browser autocomplete. It appears whenever you define autocomplete="off" or when you define no autocomplete but define type="email" for example. The global autocomplete suggests emails you've used on other sites. The global autocomplete has a manage button at the bottom and can be disabled in the browser config. image

@h2rd
h2rd / sed cheatsheet
Created November 27, 2019 17:04 — forked from un33k/sed cheatsheet
magic of sed -- find and replace "text" in a string or a file
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
@techlab23
techlab23 / Sample.vue
Last active October 16, 2020 05:24
Vue Component
<template>
<div>
<h1> {{ message }} </h1>
<div
</template>
<script>
export default {
/* Child component registration */
components: {},
@kitze
kitze / conditionalwrap.js
Created October 25, 2017 16:54
one-line React component for conditionally wrapping children
import React from 'react';
const ConditionalWrap = ({condition, wrap, children}) => condition ? wrap(children) : children;
const Header = ({shouldLinkToHome}) => (
<div>
<ConditionalWrap
condition={shouldLinkToHome}
wrap={children => <a href="/">{children}</a>}
>
@zcaceres
zcaceres / Error-Handling-Patterns-Express.md
Last active August 3, 2023 13:40
error handling patterns in Express

Handling Errors

Express.js makes it a breeze to handle errors in your routes.

Express lets you centralizes your error-handling through middleware.

Let's look at patterns for how to get the most out of your error-handling.

First, our error-handling middleware looks like this:

// O(n + n + n/2)
// O(2n + n/2)
// O(2.5n)
// O(n)
public boolean isPalindrome(String input) {
// replaceAll - n times
input = input.replaceAll("\\s","");
// replaceAll - n times
int n = input.length();
@thexande
thexande / mov2gif.sh
Last active September 18, 2016 22:33
# first run brew install ffmpeg && brew install imagemagick
# next, add lines 6 - 9 into your .zshrc or .bashrc file, depending on your shell you use ( zsh or bash )
# restart your terminal!
# then call like "movtogif in.mov out.gif"
movtogif(){
ffmpeg -i "$1" -vf scale=800:-1 -r 10 -f image2pipe -vcodec ppm - |\
convert -delay 5 -layers Optimize -loop 0 - "$2"
}
@dannyfritz
dannyfritz / Promise_Patterns.md
Last active August 4, 2021 14:38
Promise Patterns for Happier Relationships 💍

Promises

new Promise()

  • new Promise((resolve, reject) => {})
const getDinosaur = (name) => {
  return new Promise((resolve, reject) => {
    resolve({name})