Skip to content

Instantly share code, notes, and snippets.

View ohxyz's full-sized avatar
🏠
Working from home

Bush3ng Xi ohxyz

🏠
Working from home
View GitHub Profile
@ohxyz
ohxyz / loading.svg
Last active June 13, 2024 02:35
SVG circle loading spinner
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ohxyz
ohxyz / jest-config-static-resources.js
Last active January 5, 2022 22:44
Jest config for handling static resources, e.g. svg, jpg, css, etc
/* jest.config.js */
moduleNameMapper: {
'\\.svg$': '<rootDir>/src/app/__mocks__/svgr.ts',
'\\.(jpg|jpeg|png)$': '<rootDir>/configs/jest/file.mock.js',
'\\.css$': '<rootDir>/configs/jest/css.mock.js',
'^~/(.*)$': '<rootDir>/src/$1',
},
/* svgr.ts */

Improved .sr-only

Theorically bulletproof CSS class for visually hide anything and keep it accessible to ATs.

A Pen by ffoodd on CodePen.

License.

@ohxyz
ohxyz / express-examples.js
Last active December 9, 2018 23:27
Examples of express server for testing purposes
const express = require( 'express' );
const APP = express();
const PORT = 5001;
function allowCors( request, response, next ) {
response.set( 'Access-Control-Allow-Origin', '*' );
next();
}
@ohxyz
ohxyz / dynamically-load-a-child-component-in-angular.ts
Last active October 31, 2018 05:31
Dynamically load a child component in Angular
import { Component, OnInit, ComponentFactoryResolver, ViewContainerRef } from '@angular/core';
import { ChildComponent } from './child/child.component';
@Component( {
selector: 'parent',
templateUrl: './parent.component.html',
entryComponents: [ ChildComponent ]
} )
export class ParentComponent implements OnInit {
@ohxyz
ohxyz / curl.md
Created August 3, 2018 03:54 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@ohxyz
ohxyz / chrome-headless-setup
Last active October 31, 2018 05:32
Chrome headless setup
const puppeteer = require( 'puppeteer' );
describe( 'Test Suite', () => {
let page;
let browser;
beforeAll( async () => {
browser = await puppeteer.launch( { ignoreHTTPSErrors: true } );
@ohxyz
ohxyz / rename-git-branch.txt
Last active January 22, 2018 04:32
Rename a branch locally and remotely
git branch -m old-name new-name
git push origin -u new-name
git push origin :old-name
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>My Title</title>
<meta name="description" content="Basic HTML5 template">
<meta name="author" content="My Name">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="styles.css">
</head>
@ohxyz
ohxyz / mocha-chai-browser.html
Last active October 27, 2017 22:59
Use mocha and chai in browser
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Mocha and Chai Test</title>
<meta name="description" content="Mocha and chai test template">
<link href="https://cdnjs.cloudflare.com/ajax/libs/mocha/4.0.1/mocha.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>