Skip to content

Instantly share code, notes, and snippets.

@jonrimmer
jonrimmer / nested-list.html
Created October 16, 2011 16:11
Creating Tree-Tables in HTML and CSS
<ul>
<li>Jon
<ul>
<li>Bob</li>
<li>Jim</li>
<li>Dave</li>
</ul>
</li>
<li>Rob</li>
<li>Matt
@jonrimmer
jonrimmer / gist:5881843
Created June 28, 2013 01:41
CSS state machine syntax concept
@states mainLayout {
@state initial {
::host {
background-color: black;
}
.main-content {
height: 95%;
}
@jonrimmer
jonrimmer / ui-grid-resize.js
Created February 26, 2015 17:31
Auto-Resize Directive for Angular UI-Grid
(function() {
angular
.module('myApp')
.directive('myUiGridResize', myUiGridResizeDirective);
/* @ngInject */
function myUiGridResizeDirective(gridUtil, uiGridConstants) {
return {
restrict: 'A',
require: 'uiGrid',
@jonrimmer
jonrimmer / debug.md
Created December 1, 2015 15:55
atom-beautify issue

Atom Beautify - Debugging information

The following debugging information was generated by Atom Beautify on Tue Dec 01 2015 15:48:35 GMT+0000 (GMT).


Platform: darwin

Versions

@jonrimmer
jonrimmer / index.ts
Last active February 13, 2018 18:27
Storybook Angular tagged template function sketch
function ngTemplate(strings: TemplateStringsArray, ...propExpressions: any[]) {
return strings.reduce((acc, strValue, index) => {
acc.template += strValue;
if (index < propExpressions.length) {
const propKey = '__storybook_prop_' + index;
acc.template += propKey;
acc.props[propKey] = propExpressions[index];
}
return acc;
@jonrimmer
jonrimmer / component.spec.ts
Created May 3, 2018 09:32
Clearing all pending tasks from the fake async zone
import { fakeAsync, tick } from '@angular/core/testing';
import { discardFakeAsyncTimers ) from './helpers';
const myComponent = {};
describe('My Component', () => {
before(fakeAsync(() => {
myComponent.getAsyncData();
// Run async stuff.
@jonrimmer
jonrimmer / switch-cases.directive.ts
Last active August 22, 2023 17:03
jrSwitchCases
import { Directive, Input, Host, TemplateRef, ViewContainerRef, OnInit, DoCheck } from '@angular/core';
import { NgSwitch } from '@angular/common';
@Directive({
selector: '[jrSwitchCases]'
})
export class SwitchCasesDirective implements OnInit, DoCheck {
private ngSwitch: any;
private _created = false;