Skip to content

Instantly share code, notes, and snippets.

View railsstudent's full-sized avatar
🏠
Researching third-party library

Connie Leung railsstudent

🏠
Researching third-party library
View GitHub Profile
@railsstudent
railsstudent / localStorageMock.ts
Created October 19, 2018 08:03 — forked from wzr1337/localStorageMock.ts
Mock localStorage for jasmine tests in TypeScript. This is the testing script. Copy the parts between snip and snap to mock your localStorage
/// <reference path="../../library.test.d.ts"/>
import * as angular from "angular"; angular;
import * as mocks from "angular-mocks/ngMock"; mocks;
describe('feat(localStorage Mock): ', function() {
beforeAll(() => {
angular.module('mock-module',[])
});
@railsstudent
railsstudent / unsaved-changes-guard.ts
Created March 18, 2019 03:43 — forked from Splaktar/unsaved-changes-guard.ts
Guard against navigating away when there are unsaved changes
import {CanDeactivate, Router} from '@angular/router';
import {Injectable} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Observer} from 'rxjs/Observer';
import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material';
export interface CanComponentDeactivate {
canDeactivate: () => Observable<boolean> | Promise<boolean> | boolean;
}
@railsstudent
railsstudent / docker.md
Created December 8, 2020 18:12 — forked from zmts/docker.md
Docker, TypeScript, Node.js

Docker, TypeScript, Node.js

Preconditions:

  • TS application listening port: 7777
|-- dist
|-- src
|-- .dockerignore
|-- Dockerfile
@railsstudent
railsstudent / .bablerc
Created December 20, 2020 11:15 — forked from anisur3036/.bablerc
Tailwindcss with Gulp
{
"presets": ["env"]
}
@railsstudent
railsstudent / purgecss-tailwind-gulp-example.js
Created December 20, 2020 16:40 — forked from taylorbryant/purgecss-tailwind-gulp-example.js
Use PurgeCSS with Tailwind & Gulp (Inspired by @andrewdelprete)
const atimport = require("postcss-import");
const { dest, src, task } = require("gulp");
const postcss = require("gulp-postcss");
const purgecss = require("@fullhuman/postcss-purgecss");
const tailwindcss = require("tailwindcss");
const TAILWIND_CONFIG = "./tailwind.config.js";
const SOURCE_STYLESHEET = "./src/style.css";
const DESTINATION_STYLESHEET = "./build/style.css";
@railsstudent
railsstudent / gist:1519acb9a083c87b542c40eb03a29b48
Created February 16, 2021 10:24 — forked from bq1990/gist:595c615970250e97f3ea
Supertest authenticate with bearer token
'use strict';
var should = require('should');
var app = require('../../app');
var request = require('supertest')(app);
describe('GET /api/incidents', function() {
it('should require authorization', function(done) {
request
@railsstudent
railsstudent / npx command to run angular cli
Created November 1, 2023 13:44 — forked from ddieppa/npx command to run angular cli
This is the npx command to run angular cli new project without install it globally
npx -p @angular/cli ng new hello-world-project
then locally can run
npx ng g c hello-world-component
@railsstudent
railsstudent / signal-onpush-cd-resources.md
Created December 22, 2023 20:02 — forked from ilirbeqirii/signal-onpush-cd-resources.md
Signal & OnPush Change Detection in v17 resources

Local Change Detection

Tomas Trajan:

            https://www.youtube.com/watch?v=sbIlz-yuxQI&t=2513s

Kevin Kreuzer:

            https://www.youtube.com/watch?v=fAFKK8JnPkI
@railsstudent
railsstudent / empty-example.md
Created January 24, 2024 10:53 — forked from subfuzion/empty-example.md
Protocol Buffer example of importing and using empty

How to import and indicate empty request or reply messages:

import "google/protobuf/empty.proto";

service SomeService {
    rpc SomeOperation (google.protobuf.Empty) returns (google.protobuf.Empty) {}
}
@railsstudent
railsstudent / alert.rules.yml
Created February 19, 2024 13:37 — forked from krisek/alert.rules.yml
Prometheus alert rules for node exporter
groups:
- name: node_exporter_alerts
rules:
- alert: Node down
expr: up{job="monitoring-pi"} == 0
for: 2m
labels:
severity: warning
annotations:
title: Node {{ $labels.instance }} is down