Skip to content

Instantly share code, notes, and snippets.

@andfanilo
andfanilo / README.md
Created June 10, 2020 07:32
[Streamlit] Access request HTTP headers

streamlit/streamlit#1083 (comment)

from streamlit.server.Server import Server
import streamlit as st

def get_headers():
    # Hack to get the session object from Streamlit.

 current_server = Server.get_current()
@okld
okld / multipage_settings_app.py
Last active July 11, 2024 23:55
Streamlit - Settings page with session state
import streamlit as st
from persist import persist, load_widget_state
def main():
if "page" not in st.session_state:
# Initialize session state.
st.session_state.update({
# Default page.
"page": "home",
@drochgenius
drochgenius / frontend-contribution.ts
Last active October 21, 2021 07:13
Hide unused activity bar icons (view container icons)
import { injectable } from 'inversify';
import { FrontendApplicationContribution, FrontendApplication } from '@theia/core/lib/browser';
import { MaybePromise } from '@theia/core/lib/common/types';
import { Widget } from '@theia/core/lib/browser/widgets';
@injectable()
export class ExampleFrontendContribution implements FrontendApplicationContribution {
/**
* Called after the application shell has been attached in case there is no previous workbench layout state.
* Should return a promise if it runs asynchronously.
@bvaughn
bvaughn / LICENSE.md
Last active November 9, 2023 07:13
Advanced example for manually managing subscriptions in an async-safe way using hooks

The MIT License (MIT)

Copyright © <year> <copyright holders>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell

@krnd
krnd / .style.yapf
Last active February 25, 2022 04:20
python-yapf
# .style.yapf
#
# DESCRIPTION
# Configuration file for the python formatter yapf.
#
# This configuration is based on the generic
# configuration published on GitHub.
#
# AUTHOR
# krnd
@faceyspacey
faceyspacey / pathless-routes-with-redux-first-router.js
Last active June 3, 2020 00:26
Quick example showing how to use pathless routes in Redux-First Router
import api from './api'
const routesMap = {
HOME: '/', // path only route
LIST: { // route object (with a path)
path: '/list/:slug',
thunk: async (dispatch, getState) => {
const { slug } = getState().location.payload
const response = await fetch(`/api/items/${slug}`)
const items = await data.json()
@seeebiii
seeebiii / LambdaConstants.java
Last active February 9, 2024 04:17
Available default environment variables in AWS Lambda. Just copy&paste into your Node or Java project.
public class Constants {
/**
* Contains the path to your Lambda function code.
*/
public static final String LAMBDA_TASK_ROOT = System.getenv("LAMBDA_TASK_ROOT");
/**
* The environment variable is set to one of the following options, depending on the runtime of the Lambda function:
* AWS_Lambda_nodejs, AWS_Lambda_nodejs4.3, AWS_Lambda_nodejs6.10
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active August 1, 2024 11:07
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@robertpainsi
robertpainsi / commit-message-guidelines.md
Last active July 30, 2024 14:38
Commit message guidelines

Commit Message Guidelines

Short (72 chars or less) summary

More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).

Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages