Skip to content

Instantly share code, notes, and snippets.

Simon Bobrov smnbbrv

  • Munich
Block or report user

Report or block smnbbrv

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@smnbbrv
smnbbrv / memoize.decorator.ts
Last active Feb 7, 2020
Memoize decorator based on WeakMaps (respects non-primitive arguments by reference)
View memoize.decorator.ts
const globalCache = new WeakMap();
export function Memoize() {
return (target: any, propertyName: string, descriptor: TypedPropertyDescriptor<any>) => {
if (descriptor.value != null) {
descriptor.value = getNewFunction(descriptor.value);
} else if (descriptor.get != null) {
descriptor.get = getNewFunction(descriptor.get);
} else {
throw new Error('Only put a Memoize decorator on a method or get accessor.');
@smnbbrv
smnbbrv / gitlab.sh
Created Feb 5, 2019
Open Gitlab page
View gitlab.sh
open $(git config remote.origin.url | sed -E 's/[^:]+:\/\/([^@]*@){0,1}([^:\/]+)([:0-9]*)(\/.+)\.git/https:\/\/\2\4/')
@smnbbrv
smnbbrv / download-google-font.sh
Last active Nov 23, 2018
Download Google font using google-webfonts-helper. Use within the target directory
View download-google-font.sh
# see https://fonts.google.com/attribution for licensing
curl -o f.zip "https://google-webfonts-helper.herokuapp.com/api/fonts/roboto?download=zip&subsets=latin,latin-ext&variants=regular,700" \
&& unzip f.zip \
&& rm f.zip
You can’t perform that action at this time.