Skip to content

Instantly share code, notes, and snippets.

View pl0xy's full-sized avatar
:octocat:

Declan pl0xy

:octocat:
View GitHub Profile
@YBogomolov
YBogomolov / uuid.ts
Last active June 21, 2023 14:15
Type-level UUID
type VersionChar =
| '1' | '2' | '3' | '4' | '5';
type Char =
| '0' | '1' | '2' | '3'
| '4' | '5' | '6' | '7'
| '8' | '9' | 'a' | 'b'
| 'c' | 'd' | 'e' | 'f';
type Prev<X extends number> =
@pl0xy
pl0xy / getSignedUrl.ts
Last active July 18, 2022 13:31
Typescript promise wrapper for s3.getSignedUrl with correct type definitions
import { S3 } from 'aws-sdk';
const s3 = new S3();
interface GetSignedUrlExpires {
/**
* Number of seconds before the URL expires
*
* Defaults to `900`
*
@dungdm93
dungdm93 / android-gradle.yml
Last active January 26, 2024 06:49
GitLab-CI: Caching by package manager
variables:
ANDROID_COMPILE_SDK: "28"
test:unit:
image: circleci/android:api-${ANDROID_COMPILE_SDK}
cache:
key: gradle-cache
paths: [ .gradle ]
variables:
# GRADLE_OPTS: "-Dorg.gradle.daemon=false"
@staltz
staltz / comment.md
Created March 15, 2017 15:27
Nested Pick<T, K> in TypeScript 2.2

TypeScript supports Pick to allow you to get a "subset" object type of a given type, but there is no built-in Pick for deeper nested fields.

If you have a function that takes a large object as argument, but you don't use all of its fields, you can use Pick, Pick2, Pick3, etc to narrow down the input type to be only just what you need. This will make it easier to test your function, because when mocking the input object, you don't need to pass all fields of the "large" object.

@jareware
jareware / SCSS.md
Last active July 1, 2024 09:25
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

@jxson
jxson / README.md
Created February 10, 2012 00:18
README.md template

Synopsis

At the top of the file there should be a short introduction and/ or overview that explains what the project is. This description should match descriptions added for package managers (Gemspec, package.json, etc.)

Code Example

Show what the library does as concisely as possible, developers should be able to figure out how your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.

Motivation