Skip to content

Instantly share code, notes, and snippets.

@slavafomin
slavafomin / nodejs-custom-es6-errors.md
Last active Nov 18, 2021
Custom ES6 errors in Node.js
View nodejs-custom-es6-errors.md

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

errors/AppError.js

@MarsVard
MarsVard / README
Last active Sep 8, 2021
android drawable to imitate google cards.
View README
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
<View
android:layout_width="fill_parent"
@JakeWharton
JakeWharton / AspectRatioImageView.java
Created Jun 2, 2012
ImageView that respects an aspect ratio applied to a specific measurement.
View AspectRatioImageView.java
// 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
shelling / Makefile
Created Oct 20, 2010
Matlab launcher on Gnome
View Makefile
.PHONY: all
all:
mv matlab.png /usr/share/icons/hicolor/256x256/apps/
mv matlab.desktop /usr/share/applications/
echo alias matlab=\'matlab -nodisplay\' >> /etc/bash.bashrc
update-menus