Skip to content

Instantly share code, notes, and snippets.

View Splaktar's full-sized avatar

Michael Prentice Splaktar

View GitHub Profile
@alexzuza
alexzuza / di_debug_ngmodule_injector.ts
Last active February 20, 2020 22:37
DI debug Root NgModule Injector
ng.probe(getAllAngularRootElements()[0]).injector.view.root.ngModule._providers
@dinvlad
dinvlad / get-aws-token
Created October 25, 2016 23:32
Get session token for virtual MFA-enabled actions through AWS CLI
#!/bin/bash
# Thanks to MattJ at:
# http://www.brassmill.net/2015/10/using-the-aws-cli-with-roles-security-token-service-and-mfa/
#
# User must have 'iam:GetUser' permission on themselves that doesn't require MFA
[ -z $1 ] && echo "Please enter your MFA code" && exit 1
user=$(aws iam get-user \
@StephenFluin
StephenFluin / app.component.ts
Last active July 22, 2016 01:36
Angular 2 Analytics via Routing
//...
import { Router, NavigationEnd } from '@angular/router';
//...
declare var ga : any;
//..
constructor(private router : Router ) {
router.events.filter(e => e instanceof NavigationEnd).subscribe( (n:NavigationEnd) => {
@ThomasBurleson
ThomasBurleson / MediaQueryWatcher.js
Last active October 6, 2015 00:14
AngularJS MediaQueryWatcher service (es6) that supports subscribers to mediaQuery change notifications.
/**
* Service that manages subscriptions to mediaQuery changes.
* Subscribers will be notified of initialize, enter, and leave changes
* via ::attach() callback functions.
*
* @code:
*
* let self = $scope,
* layout_sm = "screen and (min-width:0px) and (max-width:599px)",
@ThomasBurleson
ThomasBurleson / flexBox.md
Last active April 26, 2017 09:59
Angular Material - FlexBox styles for Layout features
[flex] { 
  box-sizing: border-box;
 }

[flex]           { flex: 1;         } // == { flex: 1 1 0%; }
[flex="grow"]    { flex: 1 1 100%;  }
[flex="initial"] { flex: 0 1 auto;  }
[flex="auto"]    { flex: 1 1 auto;  }
[flex="none"]    { flex: 0 0 auto;  }
@paulirish
paulirish / what-forces-layout.md
Last active June 10, 2024 06:51
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@oyvindholmstad
oyvindholmstad / schema-generator.js
Last active September 21, 2018 06:54
BigQuery JSON schema generator in Javascript and Scala
/*
A script to generate a Google BigQuery-complient JSON-schema from a JSON object.
Make sure the JSON object is complete before generating, null values will be skipped.
References:
https://cloud.google.com/bigquery/docs/data
https://cloud.google.com/bigquery/docs/personsDataSchema.json
https://gist.github.com/igrigorik/83334277835625916cd6
... and a couple of visits to StackOverflow
@kingargyle
kingargyle / AndroidManifest.xml
Created August 5, 2014 13:19
Android TV Recommendation Handlers.
<!-- Required for on Android TV to receive Boot Completed events -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<!-- Need to Register the Recommendation Intent Service -->
<service android:name="us.nineworlds.serenity.core.services.OnDeckRecommendationIntentService"
android:enabled="true" android:exported="true"/>
<!-- The Receiver that actually responds to the Boot Completed event, needed
to start the recommendation service automatically when bootup has
@demisx
demisx / angularjs-providers-explained.md
Last active May 17, 2024 03:38
AngularJS Providers: Constant/Value/Service/Factory/Decorator/Provider
Provider Singleton Instantiable Configurable
Constant Yes No No
Value Yes No No
Service Yes No No
Factory Yes Yes No
Decorator Yes No? No
Provider Yes Yes Yes

Constant

@ondrej-kvasnovsky
ondrej-kvasnovsky / commands.md
Last active April 25, 2020 19:43
Commands to install and configure ElasticSearch on Ubuntu

Install ElasticSearch and Java

1  wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.0.1.deb
2  sudo dpkg -i elasticsearch-1.0.1.deb
3  sudo update-rc.d elasticsearch defaults 95 10
4  sudo add-apt-repository ppa:webupd8team/java
5  sudo apt-get update
6  sudo apt-get install oracle-java7-installer
7  java -version