Skip to content

Instantly share code, notes, and snippets.

View Asjas's full-sized avatar
🔥

A-J Roos Asjas

🔥
  • South Africa
  • 19:34 (UTC +02:00)
  • X @_asjas
View GitHub Profile

Keybase proof

I hereby claim:

  • I am asjas on github.
  • I am asjas (https://keybase.io/asjas) on keybase.
  • I have a public key whose fingerprint is 47C2 2148 2FA1 588B AF6D E764 4315 6461 0C72 F39D

To claim this, I am signing this object:

@Asjas
Asjas / v8.md
Created March 2, 2020 13:52 — forked from kevincennis/v8.md
V8 Installation and d8 shell usage

Installing V8 on a Mac

Prerequisites

  • Install Xcode (Avaliable on the Mac App Store)
  • Install Xcode Command Line Tools (Preferences > Downloads)
  • Install depot_tools
    • git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
    • sudo nano ~/.bash_profile
  • Add export PATH=/path/to/depot_tools:"$PATH" (it's important that depot_tools comes first here)
@Asjas
Asjas / Dockerfile
Last active September 20, 2020 15:36
Example Node.js Production Dockerfile
FROM node:10.16.2-stretch
EXPOSE 3000
ENV NODE_ENV production
# Create work environment and set up app
RUN mkdir /app && chown -R node:node /app
WORKDIR /app
USER node
@Asjas
Asjas / .sr-only
Last active December 8, 2020 20:01
A CSS class for screen reader content. This will hide the HTML Element from the user but will still allow screen readers to see it.
// https://hugogiraudel.com/2016/10/13/css-hide-and-seek/
.sr-only {
border: 0 !important;
clip: rect(1px, 1px, 1px, 1px) !important;
-webkit-clip-path: inset(50%) !important;
clip-path: inset(50%) !important;
height: 1px !important;
overflow: hidden !important;
padding: 0 !important;
@Asjas
Asjas / system-queries.sql
Created February 28, 2021 19:09
PostgreSQL System Table Queries
// This query returns a list of tables, in alphabetical order, with a count of the columns.
SELECT table_name
,COUNT(column_name)
FROM information_schema.columns
WHERE table_schema = 'myschema' -- put your schema here
GROUP BY table_name
ORDER BY table_name;
// This query returns a list of tables, in alphabetical order, with a count of the rows.
@Asjas
Asjas / index.js
Last active March 22, 2021 15:41
Node Backpressure Aware Copy
function backpressureAwareCopy(srcStream, destStream) {
srcStream.on('data', (chunk) => {
const canContinue = destStream.write(chunk);
if (!canContinue) {
// if we are overflowing the destination, we stop reading
srcStream.pause();
// once all the buffered data is flushed, we resume reading from source
destStream.once('drain', () => srcStream.resume());
}
})
npm set init.author.name "A-J Roos"
npm set init.author.email "asjas@hey.com"
npm set init.license "MIT"
@Asjas
Asjas / app.js
Created May 21, 2022 10:07
React "as" Prop Example
const Headline = ({ as = 'h1', children }) => {
const As = as;
return <As>{children}</As>;
};
const App = () => {
return (
<>
<Headline>Hello React</Headline>
<Headline as="h2">Hello React</Headline>
@Asjas
Asjas / luhnAlgorithm.ts
Created July 8, 2022 18:01
Luhn Algorithm
// https://github.com/muhammadghazali/mod10
function LuhnAlgorithm(RSA_ID: string) {
let isValid = false;
let checkDigit;
let sumOfAllNumbers = 0;
let reversedIdentifier = [];
const identifierString = RSA_ID;
checkDigit = identifierString.charAt(identifierString.length - 1);
// Use a font size that makes lowercase
letters half the specified font size
@supports (font-size-adjust: 1;) {
article {
font-size-adjust: 0.5;
}
}
// optimal line height
p {