Skip to content

Instantly share code, notes, and snippets.

View yousifalraheem's full-sized avatar
👾
Debugging

Yousif Al-Raheem yousifalraheem

👾
Debugging
View GitHub Profile
@yousifalraheem
yousifalraheem / TableView.swift
Created May 17, 2021 10:39
A TableView component for SwiftUI
import SwiftUI
struct TableRow: Identifiable {
let id = UUID()
let cells: [AnyView]
}
struct TableView: View {
let headers: [String]
let rows: [TableRow]
@yousifalraheem
yousifalraheem / data.json
Created December 7, 2020 08:38
FE Task data
[
{
"id": 1003,
"employeeId": "07f17d85-d8d9-4802-8db9-e1d50f96ae4b",
"firstname": "Dunn",
"lastname": "Rosales",
"dateJoined": "Fri Dec 09 1994 18:04:18 GMT+0800 (Malaysia Time)",
"salary": 5863
},
{
/** Internet Explorer */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
div {
display: block;
}
}
/** Microsoft Edge */
@supports (-ms-ime-align: auto) {
div {
@yousifalraheem
yousifalraheem / browser-detect.js
Last active September 8, 2020 10:11
Detect browser in use with JavaScript
function whichBrowser() {
if (isFirefox()) {
return "Firefox";
} else if (isEdge()) {
return "Edge";
} else if (isIE()) {
return "Internet Explorer";
} else if (isOpera()) {
return "Opera";
} else if (isVivaldi()) {
@yousifalraheem
yousifalraheem / Medium-ecf2cfb0a3f8-9.json
Created June 14, 2020 07:40
NPM Package script with cleaned up script using npm package variables for both Linux and Windows
{
"config": {
"swaggerUrl": "http://loooooong-url-to-your-application-swagger-url/v2/swagger.json"
},
"scripts": {
"generate": "openapi-generator -i $npm_package_config_swaggerUrl -g typescript-axios",
"generate:win": "openapi-generator -i %npm_package_config_swaggerUrl% -g typescript-axios"
}
}
@yousifalraheem
yousifalraheem / Medium-ecf2cfb0a3f8-8.json
Created June 14, 2020 07:38
NPM Package script with cleaned up script using npm package variables
{
"config": {
"swaggerUrl": "http://loooooong-url-to-your-application-swagger-url/v2/swagger.json"
},
"scripts": {
"generate": "openapi-generator -i $npm_package_config_swaggerUrl -g typescript-axios"
}
}
@yousifalraheem
yousifalraheem / Medium-ecf2cfb0a3f8-7.json
Created June 14, 2020 07:37
NPM Package long script with URL
{
"scripts": {
"generate": "openapi-generator -i http://loooooong-url-to-your-application-swagger-url/v2/swagger.json -g typescript-axios"
}
}
@yousifalraheem
yousifalraheem / Medium-ecf2cfb0a3f8-6.json
Last active June 14, 2020 08:38
NPM Package scripts cleaned up using pre and post hooks
{
"scripts": {
"lint": "tslint -p tsconfig.json",
"pretest": "rimraf converage",
"test": "jest",
"prebuild:prod": "npm run lint && npm test",
"build:prod": "webpack - mode production",
"prebuild": "rimraf dist",
"build": "npm run build:prod",
"postbuild": "npm run deploy",
@yousifalraheem
yousifalraheem / Medium-ecf2cfb0a3f8-5.json
Created June 14, 2020 07:35
More complicated example of clean chained scripts
{
"scripts": {
"clean:dist": "rimraf dist",
"clean:test": "rimraf converage",
"clean": "npm run clean:dist && npm run clean:test",
"lint": "tslint -p tsconfig.json",
"build:prod": "webpack - mode production",
"test": "jest",
"deploy": "gh-pages -d dist",
"build": "npm run clean && npm run lint && npm test && npm run build:prod && npm run deploy"
@yousifalraheem
yousifalraheem / Medium-ecf2cfb0a3f8-4.json
Created June 14, 2020 07:34
NPM commands moved to individual scripts
{
"scripts": {
"clean": "rimraf dist",
"lint": "tslint -p tsconfig.json",
"build:prod": "webpack -mode production",
"build": "npm run clean && npm run lint && npm run build:prod"
}
}