This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function usePushEvent<T extends object, Params extends object = object>( | |
eventName: string, | |
defaultValue?: T | |
) { | |
const live = useLiveVue(); | |
const isLoading = ref(false); | |
const isFinished = ref(false); | |
const response = ref<T | undefined>(defaultValue); | |
const error = ref<string | null>(null); | |
const execute = (data: Params) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.addEventListener("phx:page-loading-start", (_info) => { | |
Array.from(document.getElementsByTagName("a")).forEach( | |
(a) => (a.dataset.active = "false") | |
); | |
}); | |
window.addEventListener("phx:page-loading-stop", (_info) => { | |
Array.from(document.getElementsByTagName("a")).forEach( | |
(a) => {a.dataset.active = (a.href === document.location.href).toString()} | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<.flash_group flash={@flash} /> | |
<main> | |
<%= @inner_content %> | |
</main> | |
<%!-- We're doing teleport because navigation is rendered in root layout which is not updated --%> | |
<%!-- Notice "hidden" class, it's important because we're not really teleporting content, but duplicating it --%> | |
<div :if={@current_user} id="onboarding-render" phx-hook="teleport" data-teleport-target="onboarding" class="hidden"> | |
<MyApp.Onboarding.onboarding current_user={@current_user} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run --rm -it elixir:1.16 mix run --no-mix-exs -e 'Mix.install(dockerexec: "~> 2.0")' | |
* creating /root/.mix/archives/hex-2.0.6 | |
Resolving Hex dependencies... | |
Resolution completed in 0.01s | |
New: | |
dockerexec 2.0.3 | |
* Getting dockerexec (Hex package) | |
* creating /root/.mix/elixir/1-16/rebar3 | |
===> Fetching rebar3_hex v7.0.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from contextlib import contextmanager | |
from contextvars import ContextVar | |
from functools import wraps, partial | |
_sequential_execution_active = ContextVar('bulk_update_active', False) | |
_sequential_execution_callbacks = ContextVar('bulk_update_callbacks', None) | |
@contextmanager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
DISK="$1" | |
MOUNTPOINT="$2" | |
if [ -z "$DISK" ] || [ -z "$MOUNTPOINT" ]; then | |
echo "Usage: run.sh DISK MOUNTPOINT" | |
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import defaultdict | |
from operator import itemgetter | |
from time import time | |
from binance.client import Client | |
FEE = 0.0005 | |
PRIMARY = ['ETH', 'USDT', 'BTC', 'BNB'] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM openjdk:8 | |
ENV JAVA_OPTS="" | |
WORKDIR /srv | |
COPY snapshot.jar . | |
CMD ["java $JAVA_OPTS -jar snapshot.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Orignal version taken from http://www.djangosnippets.org/snippets/186/ | |
# Original author: udfalkso | |
# Modified by: Shwagroo Team and Gun.io | |
# Further modified by: Jakub Skalecki (https://rock-it.pl) | |
import hotshot | |
import hotshot.stats | |
import textwrap | |
import os |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ContactForm(forms.Form): | |
name = forms.CharField(max_length=60) | |
message = forms.CharField(max_length=200, widget=forms.TextInput) | |
class SubscriptionForm(forms.Form): | |
email = forms.EmailField() | |
want_spam = forms.BooleanField(required=False) | |
NewerOlder