Skip to content

Instantly share code, notes, and snippets.

slavafomin /
Last active Nov 18, 2021
Custom ES6 errors in Node.js

Here's how you could create custom error classes in Node.js using latest ES6 / ES2015 syntax.

I've tried to make it as lean and unobtrusive as possible.

Defining our own base class for errors


MarsVard / README
Last active Sep 8, 2021
android drawable to imitate google cards.
put card.xml in your drawables directory, put colors.xml in your values directory or add the colors to your colors.xml file.
set the background of a view to card,
as you can see in card.xml the drawable handles the card margin, so you don't have to add a margin to your view
``` xml
JakeWharton /
Created Jun 2, 2012
ImageView that respects an aspect ratio applied to a specific measurement.
// Copyright 2012 Square, Inc.
package com.squareup.widgets;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.widget.ImageView;
/** Maintains an aspect ratio based on either width or height. Disabled by default. */
public class AspectRatioImageView extends ImageView {
shelling / Makefile
Created Oct 20, 2010
Matlab launcher on Gnome
View Makefile
.PHONY: all
mv matlab.png /usr/share/icons/hicolor/256x256/apps/
mv matlab.desktop /usr/share/applications/
echo alias matlab=\'matlab -nodisplay\' >> /etc/bash.bashrc