Skip to content

Instantly share code, notes, and snippets.

@DamnedScholar
DamnedScholar / webpack.config.js
Created December 31, 2020 20:16
Webpack for Stimulus
const webpack = require('webpack');
const glob = require('glob');
const TerserPlugin = require('terser-webpack-plugin')
let globOptions = {
ignore: ['node_modules/**', 'venv/**']
}
let entryFiles = glob.sync("**/javascript/*.js", globOptions)
@DamnedScholar
DamnedScholar / Pipfile
Created February 22, 2021 19:53
pipenv bug with importing requirements.txt
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
aioredis = "==1.3.1"
alembic = "==1.4.2"
amqp = "==2.6.0"
anyjson = "==0.3.3"
@DamnedScholar
DamnedScholar / dropbox.py
Created March 24, 2021 18:50
Supervisor class for Dropbox/OSFS integration with Django
# For relative imports to work in Python 3.6
import os, sys
from fs import copy; sys.path.append(os.path.dirname(os.path.realpath(__file__)))
import logging
logger = logging.getLogger('dropbox-fs')
from django.conf import settings
@DamnedScholar
DamnedScholar / mediabox.py
Created March 30, 2021 14:41
A class that silently syncs Dropbox -> MEDIA_ROOT, serves locally, and can be as fuzzy, random, or specific as you want to be.
# For relative imports to work in Python 3.6
import os, sys
import jinja2; sys.path.append(os.path.dirname(os.path.realpath(__file__)))
import logging
logger = logging.getLogger('dropbox-fs')
from random import choice, choices, sample
@DamnedScholar
DamnedScholar / language-sampleGrammar.cson
Last active January 25, 2023 20:14
Grammar boilerplate with annotations.
# TextMate tutorial: http://manual.macromates.com/en/language_grammars
# Regex to convert keys to unquoted: '(include|match|captures|begin|end|beginCaptures|endCaptures|name|patterns|0|1|2|3|4|5|6|7|8|9|comment|fileTypes|scopeName|repository|contentName|firstLineMatch|foldingStartMarker|foldingStopMarker)':
scopeName: 'source.<scope>' # <scope> should be a short, unique indicator for the language ("js", "php", "c", etc.)
name: '<name>' # The title that will show up in grammar selection and on your status bar.
fileTypes: [ # An array of file extensions.
'txt'
'exif'
]