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
/** | |
The macro `join!` cannot be used in this context | |
because we need to add any number of asyncs, | |
not known at compile time. | |
Here we provide a list: Vec<FutureWrapper>, | |
and this list is used to call the function `join_all`. | |
Playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=eb3732a22a43ada448e35eebbd1e188a |
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
// A litte example | |
package main | |
import ( | |
"fmt" | |
"progtrailer" | |
) | |
func main() { | |
defer func() { |
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
/* | |
Java code: | |
---------- | |
try // <-- TRY HEADER | |
{ | |
throw new Exception("Error"); // <-- TRY BODY (RAISE Exception) | |
} | |
catch(final Exception err) // <-- CATCH HEADER |
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
/* | |
Example: | |
-------- | |
import ( | |
"os" | |
"log" | |
"io/ioutil" | |
"verbose_errors" |
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 JSON: | |
def __init__(self): | |
import re | |
from dateutil.parser import parse | |
from django.db.models import Model | |
from django.apps import apps | |
pattern = re.compile(r'^(\d{4}-\d{2}-\d{2})?(T)?(\d{2}:\d{2}:\d{2}(?:\.\d{6})?(?:[+-]\d{2}:\d{2})?)?$') | |
def model_decoder(o): |
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 django.template.library import Library | |
register = Library() | |
@register.filter | |
def split(s, sep= None): | |
''' | |
Example: | |
{# For details on 'assign' tag, see https://gist.github.com/corebreaker/6d94b7d06f7ed9d8bfc4985b094bf6d4 #} |
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 django.utils.encoding import force_text | |
from django.template.base import TemplateSyntaxError | |
from django.template.library import Library, Node | |
register = Library() | |
@register.simple_tag | |
def assign(value): | |
''' |