Skip to content

Instantly share code, notes, and snippets.

View thegitfather's full-sized avatar

thegitfather thegitfather

View GitHub Profile
@thegitfather
thegitfather / vanilla-js-cheatsheet.md
Last active April 17, 2024 18:56
Vanilla JavaScript Quick Reference / Cheatsheet
@thegitfather
thegitfather / visual-event-2_bookmarklet.js
Last active December 29, 2023 15:46
Visual Event is an open source Javascript bookmarklet which provides debugging information about events that have been attached to DOM elements. Visual Event shows: Which elements have events attached to them. The type of events attached to an element. The code that will be run with the event is triggered. The source file and line number for whe…
javascript:(function()%20{var%20protocol%20=%20window.location.protocol%20===%20'file:'%20?'http:'%20:%20'';var%20url%20=%20protocol+'//www.sprymedia.co.uk/VisualEvent/VisualEvent_Loader.js';if(%20typeof%20VisualEvent!='undefined'%20)%20{if%20(%20VisualEvent.instance%20!==%20null%20)%20{VisualEvent.close();}else%20{new%20VisualEvent();}}else%20{var%20n=document.createElement('script');n.setAttribute('language','JavaScript');n.setAttribute('src',url+'?rand='+new%20Date().getTime());document.body.appendChild(n);}})();
@thegitfather
thegitfather / http-status-codes.js
Last active August 21, 2023 06:17
http status codes
var httpStatusCodes = {
// 1xx Informational
// Request received, continuing process.[2]
// This class of status code indicates a provisional response, consisting only of the Status-Line and optional headers, and is terminated by an empty line. Since HTTP/1.0 did not define any 1xx status codes, servers must not send a 1xx response to an HTTP/1.0 client except under experimental conditions.
'100': 'Continue', //This means that the server has received the request headers, and that the client should proceed to send the request body (in the case of a request for which a body needs to be sent; for example, a POST request). If the request body is large, sending it to a server when a request has already been rejected based upon inappropriate headers is inefficient. To have a server check if the request could be accepted based on the request's headers alone, a client must send Expect: 100-continue as a header in its initial request[2] and check if a 100 Continue status code is received in response be
@thegitfather
thegitfather / angular.io.cheat.sheet.md
Created September 4, 2019 14:23
Angular.io Cheat Sheet

ANGULAR (2+) CHEATSHEET

NG MODULES

import { NgModule } from '@angular/core';

@NgModule({
  declarations: ...,
 imports: ...,
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
.container {
display: flex;
flex-flow: row wrap;
@thegitfather
thegitfather / debounce.js
Created May 9, 2015 02:26
js: debounce function
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
@thegitfather
thegitfather / zzz_ascii
Last active July 13, 2021 15:54
zzz_ascii
__________________
/\ ______________ \
/::\ \ZZZZZZZZZZZZ/\ \
/:/\.\ \ /:/\:\ \
/:/Z/\:\ \ /:/Z/\:\ \
/:/Z/__\:\ \____/:/Z/ \:\ \
/:/Z/____\:\ \___\/Z/ \:\ \
\:\ \ZZZZZ\:\ \ZZ/\ \ \:\ \
\:\ \ \:\ \ \:\ \ \:\ \
\:\ \ \:\ \_\;\_\_____\;\ \
@thegitfather
thegitfather / load_replace_css_js.user.js
Last active July 13, 2021 15:52
load/replace css/js
// ==UserScript==
// @name load_replace_css_js
// @namespace https://gist.github.com/search?q=thegitfather+UserScript
// @author thegitfather
// @version 0.11
// @description load/replace css/js
// @updateURL https://gist.github.com/thegitfather/679c9bc76e9b058790e3/raw/load_replace_css_js.user.js
// @downloadURL https://gist.github.com/thegitfather/679c9bc76e9b058790e3/raw/load_replace_css_js.user.js
// @include http://127.0.0.1/*
// @grant none
@thegitfather
thegitfather / favicon.html
Created January 30, 2016 11:55
favicon_yinyang.ico (inline, base64)
<link href="data:image/x-icon;base64,AAABAAEAEBAQAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAABQMAAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAREQAAAAAAEREREQAAAAEiIREREAAAEiIiERERAAASESIhEREAASIRIiERERABIiIiEREREAEiIiEREREQASIiIRIhERAAEiIhEiERAAASIiEREREAAAEiIhEREAAAABEiIREAAAAAABERAAAAAAAAAAAAAAD//wAA/D8AAPAPAADgBwAAwAMAAMADAACAAQAAgAEAAIABAACAAQAAwAMAAMADAADgBwAA8A8AAPw/AAD//wAA" rel="icon" type="image/x-icon">
@thegitfather
thegitfather / jQuery.wrapRegExp.js
Last active July 13, 2021 15:50
wrap a new element around some RegExp
(function($) {
'use strict';
$.fn.wrapRegExp = function(options) {
// defaults
var settings = $.extend({
regExp: /([\s\S]*)/,
wrapper: '<div style="border:1px solid red;" />'
}, options);