Skip to content

Instantly share code, notes, and snippets.

View klimashkin's full-sized avatar
🚀
Skyrocketing

Pavel Klimashkin klimashkin

🚀
Skyrocketing
  • Illumio
  • Mountain View, CA
View GitHub Profile
@timfee
timfee / timezones.ts
Last active April 19, 2024 18:51
Friendly Timezones
type TimeZoneInfo = {
friendlyName: string
offsetString: string
offsetNumeric: number
longTimezones: string[]
}
function offsetStringToNumeric(offsetString: string): number {
const sign = offsetString.startsWith("GMT-") ? -1 : 1
const [hours, minutes] = offsetString.slice(4).split(":").map(Number)
@awaismirza
awaismirza / openssl-cheatsheet.md
Last active February 28, 2024 18:12
OpenSSL cheatsheet

OpenSsl Cheat Sheet

Generate Key

We can use openssl Command-line utility to generate private key which will be used for generating certificate Signing Request and Certificate.

openssl genpkey -out server.key -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -aes-128-cbc

You can name your key whatever you like for example key.pem | key.key | sample.hello doesn’t matter what you name the key but the general convention is to use .pem extension.

Generate Certificate Signing Request

@OliverJAsh
OliverJAsh / README.md
Last active February 24, 2022 05:26
Flexbox gutters

Flexbox gutters

Problem

  • We use flexbox for our layout.
  • We want to add horizontal and vertical gutters inbetween these items.
  • Items wrap according to contents (flex-wrap: wrap), therefore we can't decide when/where to apply gutters using breakpoints.

Solution

Quick reference: Math

Data properties

  • Math.E: number ES1

    Euler’s number, base of the natural logarithms, approximately 2.7182818284590452354.

  • Math.LN10: number ES1

I bundled these up into groups and wrote some thoughts about why I ask them!

If these helped you, I'd love to hear about it!! I'm on twitter @vcarl_ or send me an email carl.vitullo@gmail.com

Onboarding and the workplace

https://blog.vcarl.com/interview-questions-onboarding-workplace/

  • How long will it take to deploy my first change? To become productive? To understand the codebase?
  • What kind of equipment will I be provided? Will the company pay/reimburse me if I want something specific?

Strings

String.prototype.*

None of the string methods modify this – they always return fresh strings.

  • charAt(pos: number): string ES1

    Returns the character at index pos, as a string (JavaScript does not have a datatype for characters). str[i] is equivalent to str.charAt(i) and more concise (caveat: may not work on old engines).

@nodkz
nodkz / mongoose.flowtype.js
Last active June 16, 2018 20:55
Covering mongoose models with flowtype
/* @flow */
/* eslint-disable */
import mongoose from 'mongoose';
export type MongoId = typeof mongoose.Types.ObjectId | {
toString(): string,
};
export type MongoOrScalarId = MongoId | string | number;
@DmitrySoshnikov
DmitrySoshnikov / rust-dynamic-lazy-static.md
Last active January 22, 2022 05:29
Rust notes: dynamic and global static objects

Rust notes: dynamic and global static objects

Level: novices, n00bs

Rust is a statically typed language, which helps preventing runtime bugs, and ensures memory safety at compile time, that is with no runtime costs. However, sometimes one may need using dynamic values. Also, Rust doesn't support "out of the box" complex static structures, which still can be solved with some lazy initialization tricks.

Below are some notes on dynamic data types, and global static objects in Rust programming language.

Dynamic objects