Skip to content

Instantly share code, notes, and snippets.

@alastairparagas
alastairparagas / bonds.py
Last active September 16, 2022 15:06
Treasury, TIPS and I-bonds: Playing with bonds
import numpy as np
import matplotlib.pyplot as plt
np.seterr(all="ignore")
import matplotlib.ticker as ticker
import numpy_financial
# Treasury, TIPS and I-bonds - these are all bonds, which allows you to lend
# a $ amount (principal) to the US government. The US government promises to pay
# you back in time (years).
@samselikoff
samselikoff / authed-swr-provider.js
Created July 19, 2021 04:32
Example useAuth hook using Zustand, SWR and Suspense
import firebase from "firebase/app";
import "firebase/auth";
import { gql, GraphQLClient } from "graphql-request";
import { SWRConfig } from "swr";
import create from "zustand";
import { computed } from "zustand-middleware-computed-state";
const firebaseConfig = {
//
};
Some courses I think are neat and have recordings
Lots of deep learning, + some cs, science and math
Online classes in progress
* Stanford CS224n NLP w/ DL https://web.stanford.edu/class/archive/cs/cs224n/cs224n.1194/
Online classes todo
* Stanford CS224W ML with Graphs http://web.stanford.edu/class/cs224w/
* Stanford CS234 RL (vids from 2019) https://web.stanford.edu/class/cs234/CS234Win2019/schedule.html https://web.stanford.edu/class/cs234/
* Stanford CS330 Deep Multi-Task and Met aLearning (vids from 2019) https://cs330.stanford.edu/
@joseftw
joseftw / Result
Last active October 5, 2022 00:32
public class Result
{
protected Result(bool success, string message = null) : this(success, message, Enumerable.Empty<Error>()) { }
protected Result(bool success, string message, IEnumerable<Error> errors)
{
Success = success;
Message = message;
Errors = errors ?? Enumerable.Empty<Error>();
}
@simondavies
simondavies / ReactJS-Cookie.js
Last active August 13, 2021 11:36
A React JS & ES2015 Cookies pop up component and example files
@simondavies
simondavies / VueJS-Cookies-message.js
Last active June 14, 2016 09:02
Example Combination of Vue JS with ES2015 style, using babelify to ports to the current ES5.
/**
* Cookies Pop Up Component
* A pop up to inform the user that cookies are used on a/this site.
*
* usage:
* <cookie></cookie>
*
* User Overwite the generic message and expiry days,
* add 'cookie-message' and/or 'days-to-expire' properties to the component
* <cookie
@ssinss
ssinss / EndlessRecyclerOnScrollListener.java
Last active January 19, 2024 08:52
Endless RecyclerView OnScrollListener
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName();
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
int firstVisibleItem, visibleItemCount, totalItemCount;
@burgalon
burgalon / AccountAuthenticator.java
Last active July 15, 2023 08:29
Implementing OAuth2 with AccountManager, Retrofit and Dagger
public class AccountAuthenticator extends AbstractAccountAuthenticator {
private final Context context;
@Inject @ClientId String clientId;
@Inject @ClientSecret String clientSecret;
@Inject ApiService apiService;
public AccountAuthenticator(Context context) {
super(context);
<VirtualHost *:80>
ServerName 192.168.33.10.xip.io
DocumentRoot /vagrant
<Directory /vagrant>
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
@romannurik
romannurik / DrawInsetsFrameLayout.java
Created February 10, 2014 16:28
DrawInsetsFrameLayout — adding additional background protection for system UI chrome when using KitKat’s translucent decor flags.
/*
* Copyright 2014 Google Inc.
*
* 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