Skip to content

Instantly share code, notes, and snippets.

@ryzy
ryzy / spec.ts
Created August 24, 2020 10:57
isTextContext
describe('#isTestContext', () => {
beforeEach(() => {
delete process.env.JEST_WORKER_ID;
delete (window as any).__karma__;
delete (window as any).Cypress;
});
it('#isTestContext should be true for Jest', () => {
expect(isTestContext()).toBe(false);
process.env.JEST_WORKER_ID = '1';
expect(isTestContext()).toBe(true);
@ryzy
ryzy / md-theme.scss
Last active June 30, 2018 17:03
Angular Material themes - structure
@include mat-core($typography-config = null):
- angular-material-typography():
- mat-base-typography()
- mat-autocomplete-typography()
- mat-button-typography()
- mat-card-typography()
- mat-form-field-typography()
- mat-table-typography()
- ...
- mat-ripple() // basic styling for ripple effects
// define your alternative colors, similar way to the default theme
...
// Create the theme object (a Sass map containing all of the palettes).
$alt-theme: mat-dark-theme($dark-primary, $dark-accent, $dark-warn);
.theme-dark {
@include angular-material-theme($my-app-theme);
}
@ryzy
ryzy / app-theme-default.scss
Last active June 30, 2018 16:31
Angular Material theming
@import '~@angular/material/theming';
// Include so-called "core" styles containing:
// - typography
// - CDK overlay (for modals)
// - CDK a11y (accessibilty)
// - ripple effects (for buttons, checkboxes etc)
@include mat-core();
// Define your own color pallette.
@ryzy
ryzy / asdfas.js
Last active April 10, 2018 08:45
CircleCI
if(sth) {
return true;
}
$ ./node_modules/.bin/ng build -prod
10% building modules 5/7 modules 2 active ...y/Projects/ng130-rc1/src/polyfills.tsThe final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string
Date: 2017-07-25T13:38:57.296Z
Hash: 09f0d385e550699e1598
Time: 8137ms
chunk {0} polyfills.dd45430000a45d374f3f.bundle.js (polyfills) 96.2 kB {4} [initial] [rendered]
chunk {1} main.17af88c8e59171accd9c.bundle.js (main) 411 bytes {3} [initial] [rendered]
chunk {2} styles.d41d8cd98f00b204e980.bundle.css (styles) 0 bytes {4} [initial] [rendered]
chunk {3} vendor.8542a2935620d014b820.bundle.js (vendor) 210 kB [initial] [rendered]
chunk {4} inline.30c43ecf816783e63fa7.bundle.js (inline) 1.45 kB [entry] [rendered]
@ryzy
ryzy / package.json
Created July 25, 2017 09:07
ng-1.3.0-rc.1
{
"name": "ng130-rc1",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
@ryzy
ryzy / docker-compose.yml
Created March 13, 2016 13:22
Docker Compose with HAProxy and Nginx
# Launch Nginx backend server
nginx:
image: million12/nginx
ports:
- '4080:80'
- '4443:443'
environment:
- NGINX_GENERATE_DEFAULT_VHOST=true
@ryzy
ryzy / haproxy.cfg
Created March 13, 2016 00:23
HAProxy - essentials for HTTP/2
frontend https-in
mode tcp
bind *:443 ssl crt /etc/ssl/dummy.pem alpn h2,http/1.1
use_backend nodes-http2 if { ssl_fc_alpn -i h2 }
default_backend nodes-http
backend nodes-http
server node1 web.server:80 check
backend nodes-http2
@ryzy
ryzy / haproxy.cfg
Created March 13, 2016 00:20
HAProxy conf with SSL termination and HTTP/2 support
global
#debug
chroot /var/lib/haproxy
user haproxy
group haproxy
pidfile /var/run/haproxy.pid
# Default SSL material locations
ca-base /etc/ssl/certs
crt-base /etc/ssl/private