Skip to content

Instantly share code, notes, and snippets.

View miguelespinoza's full-sized avatar
💻
Focusing

Miguel Espinoza miguelespinoza

💻
Focusing
View GitHub Profile
@miguelespinoza
miguelespinoza / MainActivty.java
Last active August 29, 2015 14:08
Trying to implement a Discrete Slider using material design specifications.
public class MainActivity extends Activity {
private RelativeLayout mTagContainer;
private RelativeLayout mDiscreteTag;
private ImageView mImageTag;
private TextView mLabelTag;
private SeekBar mSeekbar;
private Context mContext;
@Override
@miguelespinoza
miguelespinoza / auth.ts
Last active September 21, 2022 19:12
Support supabase v2 refresh token logic for browser extensions
const EXPIRY_MARGIN = 10 * 1000;
class Auth {
initialize = async () => {
// Get the latest session, token may be refreshed
const { data, error } = await supabase.auth.getSession();
if (error) throw error;
if (data.session?.expires_at) {
// Create an alarm 10 seconds before token expiring