View gist:5ee232d1dde0f66ca8d968db098dba9d
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
EffectAsset { | |
name: "particle_swirl", | |
capacity: 8192, | |
spawner: Spawner { | |
num_particles: Single( | |
64.0, | |
), | |
spawn_time: Single( | |
1.0, | |
), |
View git-today
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/sh | |
# git-today | |
# | |
# Usage: | |
# * Name it `git-today` and put somewhere inside a `$PATH` directory | |
# * Invoke as $ git today | |
LAST_BEFORE_TODAY=$(git log --oneline --until='yesterday 23:59:59' | head -1 | cut -d' ' -f 1) | |
git --no-pager diff ${LAST_BEFORE_TODAY}..HEAD --stat |
View count_bevy_plugins.rs
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
// License: BSD-3 | |
use std::io::{self, Write}; | |
use std::string::FromUtf8Error; | |
use std::sync::Arc; | |
use antidote::RwLock; | |
use bevy::prelude::*; | |
use bevy::reflect::FromReflect; | |
use bevy::utils::tracing::{self, Dispatch}; |
View auth.py
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
""" | |
Requests' authenticator that attaches given parameters | |
to the URL query string. | |
License: Public Domain. | |
""" | |
from requests.auth import AuthBase | |
class QueryStringAuth(AuthBase): |
View requestcontexttask.py
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 celery import Task | |
from flask import has_request_context, make_response, request | |
from myapp import app | |
__all__ = ['RequestContextTask'] | |
class RequestContextTask(Task): |
View lambdacode.py
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
import ast | |
import inspect | |
import os | |
def get_short_lambda_source(lambda_func): | |
"""Return the source of a (short) lambda function. | |
If it's impossible to obtain, returns None. | |
""" | |
try: |
View keyword_stats.py
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
""" | |
Analyzing keywords from different programming languages. | |
""" | |
def word_stats(words): | |
count = len(words) | |
len_sum = sum(map(len, words)) | |
return { | |
'count': count, | |
'total_chars': len_sum, |
View compact.py
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
def compact(*args): | |
''' compact() function, analoguous to the PHP version. | |
Converts a series of (possible nested) iterables containing variable names | |
into a dictionary mapping those names to variable values. | |
Example: | |
>>> x, y, z, a, b, c = 1, 2, 3, 4, 5, 6 | |
>>> compact('x', ['y','z'], ['a', ['b'], [['c']]]) | |
{'a': 4, 'b': 5, 'c': 6, 'x': 1, 'y': 2, 'z': 3} | |
''' | |
def _compact_arg(res, arg): |
View missing_dict.py
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
import collections | |
missing = object() | |
class MissingDict(dict): | |
"""Dictionary that supports a special 'missing' value. | |
Assigning a missing value to key will remove the key from dictionary. | |
Initializing a key with missing value will result in key not being | |
added to dictionary at all. |
View l.py
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 L(object): | |
def __init__(self, iterable): | |
self.value = iterable | |
def map(self, fn): | |
self.value = map(fn, self.value) | |
return self | |
def join(self, s): | |
self.value = s.join(self.value) | |
return self | |
NewerOlder