Skip to content

Instantly share code, notes, and snippets.

Avatar

Tim Hobbs timhobbs

View GitHub Profile
@rossholdway
rossholdway / activated-route-stub.ts
Last active May 19, 2020
Stub Angular 2+ routers activatedRoute.
View activated-route-stub.ts
import {
DefaultUrlSerializer,
convertToParamMap,
ParamMap,
Params,
UrlSegment,
UrlSegmentGroup,
PRIMARY_OUTLET
} from '@angular/router';
import { ReplaySubject } from 'rxjs';
@lansana
lansana / infinite-scroll.directive.ts
Last active Oct 26, 2020
This is an Angular 2 infinite scroll directive. It is simple, easy to use and very CPU-efficient.
View infinite-scroll.directive.ts
// USAGE:
//
// When you attach the infiniteScroll directive to an element, it will emit the infiniteScrollAction
// @Output() event every time the user has scrolled to the bottom of the element. Your loadMoreArticles
// function can make an HTTP call and append the results to the articles list, for example. In doing this,
// you effectively increase the height of the element and thus begin the process of the infiniteScroll directive
// again, over and over until the element height stops increasing.
//
// <div class="container" infiniteScroll (infiniteScrollAction)="loadMoreArticles()">
// <div class="article" *ngFor="let article of articles">
@benjamincharity
benjamincharity / mockActivatedRoute.ts
Created Apr 12, 2017
Mock ActivatedRoute with params, data and snapshot.
View mockActivatedRoute.ts
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
MdToolbarModule,
],
providers: [
{
provide: Router,
useClass: MockRouter,
},
@c9s
c9s / .babelrc
Last active Oct 31, 2020
webpack + babel + typescript + es6 - total solutions!
View .babelrc
{
"presets": ["es2015"],
"plugins": ["transform-runtime"]
}
@gabonator
gabonator / api.txt
Created Jan 16, 2016
tvheadend json api calls for version 4.0.8
View api.txt
http://admin:admin@192.168.1.239:9981/api/serverinfo
{"sw_version": "4.0.8~wheezy","api_version": 15,"name": "Tvheadend","capabilities": ["caclient","tvadapters","satip_client","satip_server","trace"]}
http://admin:admin@192.168.1.239:9981/api/epg/events/grid
- returns tv listings guilde
http://admin:admin@192.168.1.239:9981/api/channel/list
- returns list of all tv/radio channels
{"entries":[ {"key": "8da5751f0c30fc8317d7d5875ce87bd4","val": "Markiza"}, ... }
@benlinton
benlinton / multiple_mysql_versions_for_development.md
Last active Oct 15, 2020
Multiple MySQL Versions with Homebrew
View multiple_mysql_versions_for_development.md

Multiple MySQL Versions for Development

Options included below:

  • Using Docker docker-compose
  • Using Homebrew brew

Using Docker (recommended)

This gist was originally created for Homebrew before the rise of Docker, yet it may be best to avoid installing mysql via brew any longer. Instead consider adding a barebones docker-compose.yml for each project and run docker-compose up to start each project's mysql service.

@tegansnyder
tegansnyder / disable mcafee endpoint protection.md
Last active Nov 23, 2020
Disable McAffee Endpoint Protection OSX
View disable mcafee endpoint protection.md

method 1

sudo /usr/local/McAfee/AntiMalware/VSControl stopoas

alternatively

sudo defaults write /Library/Preferences/com.mcafee.ssm.antimalware.plist OAS_Enable -bool False
sudo /usr/local/McAfee/AntiMalware/VSControl stop
sudo /usr/local/McAfee/AntiMalware/VSControl reload
View 1-restify-server-cheatsheet.js
// Restify Server CheatSheet.
// More about the API: http://mcavage.me/node-restify/#server-api
// Install restify with npm install restify
// 1.1. Creating a Server.
// http://mcavage.me/node-restify/#Creating-a-Server
var restify = require('restify');
@lttlrck
lttlrck / gist:9628955
Created Mar 18, 2014
rename git branch locally and remotely
View gist:9628955
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active Nov 19, 2020
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew
View fix-homebrew-npm.md

READ THIS Very Important Update

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

You can’t perform that action at this time.