This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
LazyCssComponent = React.lazy(() => import('./cssComponent')) | |
AnotherLazyCssComponent = React.lazy(() => import('./anotherCssComponent')) | |
export const App: React.FC = () =>( | |
<React.Suspense fallback={<></>}> | |
{condition && <LazyCssComponent/>} | |
{!condition && <AnotherLazyCssComponent/>} | |
</React.Suspense> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, Input, HostBinding } from '@angular/core'; | |
/* | |
<gist-keeps-class class="some classes" [booleanInput]="true" [stringInput]="some-thing"></gist-keeps-class> | |
will output this: | |
<gist-keeps-class class="some classes has-boolean some-thing" > | |
this component keeps class="class" attributes | |
</gist-keeps-class> | |
it's not throughly tested, but should work? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author http://bradford.digital | |
* @link https://stackoverflow.com/questions/42949647/resolve-type-of-component-from-string-in-angular2 | |
* | |
* Keep a registry of key:value pairs that is the string name of a component and the Component reference | |
* The registry is stored in an exported const named COMPONENTREGISTRY | |
* Add to the registry by using the registerComponent() function as an adorner. example: | |
* @registerComponent | |
* @Component({...}) | |
* export class AnExampleComponent {...} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Angular 2 Recursive List</h1> | |
<ul> | |
<ng-template #recursiveList let-list> | |
<li *ngFor="let item of list"> | |
{{item.title}} | |
<ul *ngIf="item.children.length > 0"> | |
<ng-container *ngTemplateOutlet="recursiveList; context:{ $implicit: item.children }"></ng-container> | |
</ul> | |
</li> | |
</ng-template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Safari Form Validation Pollyfill | |
* halts form submission if it has invalid required fields | |
* and adds tool tip emulating other browser's native behavior | |
* Tooltip is styled to match safari | |
* | |
* @requires modernizer.js | |
* @link https://gist.github.com/arniebradfo/1d59554b8e2db28d1b3effc048be06cc/ | |
* @author James Bradford | |
* @link http://arniebradfo.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // ...in functions.php | |
// adds wp shortcode that adds css classes to the html body | |
// use in your page and post content like this: | |
// [bodyclass class="add these classes to the body"] | |
function use_bodyclass_shortcode( $classes ) { | |
global $post; | |
// check if the post has the bodyclass shortcode |