Skip to content

Instantly share code, notes, and snippets.

@bradfrost
bradfrost / gist:59096a855281c433adc1
Last active September 4, 2023 15:01
Why I'm Not A JavaScript Developer

Answering the Front-end developer JavaScript interview questions to the best of my ability.

  • Explain event delegation

Sometimes you need to delegate events to things.

  • Explain how this works in JavaScript

This references the object or "thing" defined elsewhere. It's like "hey, thing I defined elsewhere, I'm talkin' to you."

  • Explain how prototypal inheritance works.
@paulirish
paulirish / bling.js
Last active July 23, 2025 07:08
bling dot js
/* bling.js */
window.$ = document.querySelector.bind(document);
window.$$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function(name, fn) { this.addEventListener(name, fn); };
NodeList.prototype.__proto__ = Array.prototype;
NodeList.prototype.on = function(name, fn) { this.forEach((elem) => elem.on(name, fn)); };
@nathansmith
nathansmith / css_pre_post_processing_expanation.md
Last active August 29, 2015 14:23
Eat Lightning and Crap Thunder™ — aka: CSS Mullet — Sass in the front, PostCSS in the back :)

CSS Pre-Processing

When it comes to languages that power the web, CSS is a double-edged sword. Often heralded for being quick to learn, like chess it takes awhile to master. Due to its simplicity, it is easy to get to a point where CSS files become unruly, mired by code repetition and lack of consistency.

Enter CSS pre-processors (and post-processors). Of all the CSS pre-processing approaches, Sass (Syntactically Awesome Style Sheets) is the clear front-runner.

http://sass-lang.com

Metaphorically, Sass is to CSS what jQuery is to JavaScript. Not only that, Sass gives CSS a seat at the table of first-class programming languages.

@mxstbr
mxstbr / Readme.md
Last active October 20, 2024 20:44
Enable tab completion for JSX with Emmet in Atom

Enable tab completion for JSX with Emmet in Atom

This guide assumes you have the emmet and language-babel packages already installed in Atom

Gif of the tab completion working

  1. Open the keymap.cson file by clicking on Atom -> Keymap… in the menu bar
  2. Add these lines of code to your keymap:
'atom-text-editor[data-grammar~="jsx"]:not([mini])':
@artibella
artibella / app.js
Created January 19, 2017 20:06
Use Fractal as a custom Express view engine
// example Express server using the custom Fractal view engine
const express = require('express');
const path = require('path');
const appRoot = path.normalize(path.join(__dirname, '..'));
const app = express();
const fractalEngine = require(path.join(appRoot, 'lib/fractal-engine'));
const loadComponents = require(path.join(appRoot, 'middleware/load-components'));
// register custom Fractal rendering engine
app.engine('fractal', fractalEngine);
@Klaudioz
Klaudioz / conversion-optimization-framework.md
Created July 30, 2025 15:49
claude-code conversion optimization framework

claude-code conversion optimization framework

  1. Headline 4-U Formula: Useful, Unique, Urgent, Ultra-specific (88% won’t read past this)
  2. Above-Fold Value Proposition: Customer problem focus, no company story, zero scroll required
  3. CTA First-Person Psychology: “Get MY guide” vs “Get YOUR guide” (90% more clicks)
  4. 5-Field Form Maximum: Every field kills conversions, progressive profiling for the rest
  5. Message Match Precision: Ad copy, landing page headline, broken promises = bounce
  6. Social Proof Near CTAs: Testimonials with faces/names, results, placed at decision points
  7. Cognitive Bias Stack: Loss aversion (fear), social proof (FOMO), anchoring (pricing)
  8. PAS Copy Framework: Problem > Agitate > Solve, emotion before logic