Skip to content

Instantly share code, notes, and snippets.

💭
🌌

Gideon Kreitzer gidhon

💭
🌌
Block or report user

Report or block gidhon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gidhon
gidhon / express-server-side-rendering.md
Created Sep 10, 2019 — forked from joepie91/express-server-side-rendering.md
Rendering pages server-side with Express (and Pug)
View express-server-side-rendering.md

Terminology

  • View: Also called a "template", a file that contains markup (like HTML) and optionally additional instructions on how to generate snippets of HTML, such as text interpolation, loops, conditionals, includes, and so on.
  • View engine: Also called a "template library" or "templater", ie. a library that implements view functionality, and potentially also a custom language for specifying it (like Pug does).
  • HTML templater: A template library that's designed specifically for generating HTML. It understands document structure and thus can provide useful advanced tools like mixins, as well as more secure output escaping (since it can determine the right escaping approach from the context in which a value is used), but it also means that the templater is not useful for anything other than HTML.
  • String-based templater: A template library that implements templating logic, but that has no understanding of the content it is generating - it simply concatenates together strings, potenti
View keybase.md

Keybase proof

I hereby claim:

  • I am gidhon on github.
  • I am gidhon (https://keybase.io/gidhon) on keybase.
  • I have a public key ASCh5-nkgYd67C60GxOj7V8HziFlnQ6dKNO7oihYgqdXTQo

To claim this, I am signing this object:

@gidhon
gidhon / snippets.cson
Created Oct 20, 2018
Stylus snippets for Platframe | editor: Atom
View snippets.cson
'.source.stylus':
'Set size: 2D (equilateral | [width, height])':
prefix: 'size'
body: 'size($1px)'
'Unit conversion: px ⟶ rem':
prefix: 'rem'
body: 'rem($0px)'
'@media: min-width':
prefix: 'Platframe: min-width'
body: '+min($1)'
@gidhon
gidhon / stylus.json
Created Oct 20, 2018
Stylus snippets for Platframe | editor: VS Code
View stylus.json
{
"Set size: 2D (equilateral | [width, height])":{
"prefix":[
"Platframe | size (both [w, h])",
"size"
],
"body":[
"size($0px)"
],
"description":"Set the width and height of an element"
@gidhon
gidhon / git_commit_reset.md
Last active Aug 29, 2015
Creating a new branch to discard commit history
View git_commit_reset.md

Discard commits while saving changes

Scenario

You have made some commits, pushed it upstream to the remote branch, then realized that some or all of those commits must for some reason not be included. In example, accidently commiting large multimedia files (blobs) that will forever bloat the commit history of the branch.

  1. ensure all changes are commited in your current, "faulty" branch
  2. switch to your master branch
    • git checkout master
  3. update master with latest changes on remote
View Stylus-Mixin-for-Linear-Gradients.markdown

Stylus Mixin for Linear Gradients

A Stylus mixin for linear gradients with support for comma-separated splat arguments. In part created as a work-around / abstraction for this.

The method for retrieving the fall-back background colour can do with some improvement, such as averaging the colours or selecting a colour by means of passing an additional argument.

View it on CodePen

You can’t perform that action at this time.