Skip to content

Instantly share code, notes, and snippets.

@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'
]
@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 / 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 / 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 / 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 / npm-debug.log
Created November 8, 2017 23:05
Attempting to run Gatsby
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'dedupe' ]
2 info using npm@3.10.8
3 info using node@v7.0.0
4 silly loadCurrentTree Starting
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly dedupe normalizeTree
@DamnedScholar
DamnedScholar / process-palette.json
Created October 20, 2017 05:47
A Process Palette configuration file created as a sample for a StackOverflow answer.
{
"patterns": {
"P1": {
"expression": "(path):(line)"
},
"P2": {
"expression": "(path)\\s+(line)",
"path": "(?:\\/[\\w\\.\\-]+)+"
}
},
! special
*.foreground: #ecdeff
*.background: #0f1609
*.cursorColor: #ecdeff
! black
*.color0: #22281f
*.color8: #333c2e
! red
@DamnedScholar
DamnedScholar / gist:c55194c14c3fc08abb3a7d8aab3d4a21
Created November 2, 2016 02:59
Javascript spec error message
ES6 tagged HTML string templates
it tokenizes them as strings
Expected { value : 'hey ', scopes : [ 'source.js', 'string.quoted.template.html.js' ] } to equal { value : 'hey <b>', scopes : [ 'source.js', 'string.quoted.template.html.js' ] }.
at .<anonymous> (file:///D:/github/atom/language-javascript/spec/javascript-spec.coffee:613:27)
Expected { value : '<', scopes : [ 'source.js', 'string.quoted.template.html.js', 'meta.tag.inline.any.html', 'punctuation.definition.tag.begin.html' ] } to equal { value : '${', scopes : [ 'source.js', 'string.quoted.template.html.js', 'source.js.embedded.source', 'punctuation.section.embedded.js' ] }.
at .<anonymous> (file:///D:/github/atom/language-javascript/spec/javascript-spec.coffee:614:27)
Expected { value : 'b', scopes : [ 'source.js', 'string.quoted.template.html.js', 'meta.tag.inline.any.html', 'entity.name.tag.inline.any.html' ] } to equal { value : 'name', scopes : [ 'source.js', 'string.quoted.template.html.js', 'source.js.embedded.source' ] }.
at .<anonymous> (fi
@DamnedScholar
DamnedScholar / gist:6bcc95a41cea746a5350508137eb165c
Created November 2, 2016 02:54
Atom language-javascript HTML embedding specs
describe 'HTML strings', ->
beforeEach ->
waitsForPromise ->
atom.packages.activatePackage("language-html")
describe "ES6 tagged HTML string templates", ->
it "tokenizes them as strings", ->
{tokens} = grammar.tokenizeLine('html`hey <b>${name}</b>`')
expect(tokens[0]).toEqual value: 'html', scopes: [ 'source.js', 'string.quoted.template.html.js', 'entity.name.function.js' ]
expect(tokens[1]).toEqual value: '`', scopes: [ 'source.js', 'string.quoted.template.html.js', 'punctuation.definition.string.begin.js' ]