Skip to content

Instantly share code, notes, and snippets.

David Marquis davidmarquis

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am davidmarquis on github.
  • I am davidmarquis (https://keybase.io/davidmarquis) on keybase.
  • I have a public key ASC4fsgvckvQCU3bPBpBYwAZQkOdhlfg_qZodcxAEais3go

To claim this, I am signing this object:

@davidmarquis
davidmarquis / angular2-lazy-load-images-with-blazy.ts
Last active Apr 11, 2017
Angular 2: Lazy-loading images using bLazy.js
View angular2-lazy-load-images-with-blazy.ts
import { Directive, ElementRef, Input, AfterViewChecked, OnDestroy } from "@angular/core";
import * as Blazy from "blazy";
/**
* Directive to setup lazy image loading using bLazy.
* Apply the directive on a container element that is a parent of `img` elements configured for bLazy.
* The container element must have an ID and be scrollable (overflow: scroll).
*
* Sample usage:
*
@davidmarquis
davidmarquis / angular2-if-media-query-directive.ts
Last active Dec 7, 2018
Angular 2: Conditional output from media query using a structural directive
View angular2-if-media-query-directive.ts
import { Directive, TemplateRef, ViewContainerRef } from "@angular/core";
import { isBlank } from "@angular/core/src/facade/lang";
/**
* How to use this directive?
*
* ```
* <div *ngIfMediaQuery="'(min-width: 500px)'">
* Div element will exist only when media query matches, and created/destroyed when the viewport size changes.
@davidmarquis
davidmarquis / django_cms_disable_toolbar.py
Created Aug 7, 2015
Django CMS disable toolbar for specific URLs
View django_cms_disable_toolbar.py
"""
Hi-jacked version of Django CMS's toolbar middleware that
excludes the toolbar from specific URLs (as defined in settings).
To use it, replace 'cms.middleware.ToolbarMiddleware' with a
reference to this class.
Then set `CMS_TOOLBAR_EXCLUDED_URLS` in your Django settings:
```
CMS_TOOLBAR_EXCLUDED_URLS = [
You can’t perform that action at this time.