Skip to content

Instantly share code, notes, and snippets.

View Pkmmte's full-sized avatar
🎯
Focusing

Pkmmte Xeleon Pkmmte

🎯
Focusing
View GitHub Profile
@ef4
ef4 / examples.md
Last active April 2, 2024 17:38
Webpack 5 Node Polyfills Upgrade Cheatsheet

Webpack 5 Node Polyfills Upgrade Cheatsheet

Webpack 4 automatically polyfilled many Node APIs in the browser. This was not a great system, because it could lead to surprisingly giant libraries getting pulled into your app by accident, and it gave you no control over the exact versions of the polyfills you were using.

So Webpack 5 removed this functionality. That means you need to make changes if you were relying on those polyfills. This is a quick reference for how to replace the most common patterns.

List of polyfill packages that were used in webpack 4

For each automatically-polyfilled node package name on the left, this shows the name of the NPM package that was used to polyfill it on the right. Under webpack 5 you can manually install these packages and use them via resolve.fallback.

@code-crusher
code-crusher / ReverseInterpolator.java
Created August 4, 2016 21:05
Reverse Interpolator Android Animation
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
class ReverseInterpolator implements Interpolator {
private Interpolator interpolator;
public ReverseInterpolator(Interpolator interpolator) {
this.interpolator = interpolator;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.os.Build;
import android.transition.Transition;
import android.transition.TransitionValues;
import android.view.ViewGroup;
@scana
scana / RxAppBarLayout.java
Last active March 11, 2016 23:12
RxAppBarLayout for observing AppBarLayout vertical offset
import android.support.design.widget.AppBarLayout;
import rx.Observable;
import rx.Subscriber;
import rx.Subscription;
/**
* Helper class for creating Observable of AppBarLayout visibility.
* Can be easily modified to return Integer values, if one needs to user verticalOffset param directly.
* See for further info: http://stackoverflow.com/questions/30779667/android-collapsingtoolbarlayout-and-swiperefreshlayout-get-stuck
@madx
madx / webpack.server.config.js
Created September 15, 2015 13:55
Webpack config for an Express app in Node.js
const path = require("path")
const fs = require("fs")
// -- Webpack configuration --
const config = {}
// Application entry point
config.entry = "./src/server/index.js"
@ArthurSav
ArthurSav / WrapGridLayoutManager.java
Created September 11, 2015 14:45
GridLayoutManager with working wrap_content.
package com.inperson.android.utils.leastview;
import android.content.Context;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
public class WrappableGridLayoutManager extends GridLayoutManager {
@fpezzato
fpezzato / CustomCollapseToolbarLayout
Created June 25, 2015 14:00
A CollapsingToolbarLayout that exposes private properties (ExpandedMargin so far)
package org.fpezzato;
import android.content.Context;
import android.support.design.widget.CollapsingToolbarLayout;
import android.util.AttributeSet;
import com.google.common.base.Throwables;
import java.lang.reflect.Field;
@Dogesmith
Dogesmith / Code.java
Last active January 31, 2022 12:35
Android Multi-line EditText which prevents newline characters from being added
mContent = (EditText) v.findViewById(R.id.dialog_item_content_EditText);
mContent.setText(mContentInit);
mContent.setRawInputType(InputType.TYPE_CLASS_TEXT);
mContent.setImeActionLabel(getResources().getString(R.string.done), EditorInfo.IME_ACTION_DONE);
mContent.setImeOptions(EditorInfo.IME_ACTION_DONE);
mContent.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (event == null) {
@lauw
lauw / SnappingRecyclerView.java
Created May 4, 2015 23:00
Snapping RecyclerView (Horizontal)
/*
* Copyright 2015 Laurens Muller.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@raghubetina
raghubetina / heroku.md
Last active January 5, 2024 04:40
Heroku Cheatsheet

Heroku Cheatsheet

Get the Heroku toolbelt

Sign up for a Heroku account and install the toolbelt if you haven't already.

Prepare your application

In your Gemfile, add