Skip to content

Instantly share code, notes, and snippets.

View bpj's full-sized avatar

Benct Philip Jonsson bpj

View GitHub Profile
@efrederickson
efrederickson / RomanNumeralConverter.lua
Created November 15, 2012 18:40
Roman numeral conversion library in pure Lua
--[[
Symbol Value
I 1
V 5
X 10
L 50
C 100
D 500
M 1000
@losinggeneration
losinggeneration / moon.xml
Created January 15, 2014 06:44
A MoonScript syntax file for Kate
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<!--
By Harley Laue <losinggeneration@gmail.com>
Based on the CoffeeScript syntax file by Max Shawabkeh (max99x@gmail.com)
and the Lua syntax file by Bruno Massa
-->
<language name="MoonScript"
version="1.0"
@razius
razius / chrome-refresh.sh
Last active November 6, 2018 13:50
Watches the folder or files passed as arguments to the script and when detects a change it automatically refreshes the current selected Chrome tab or window.
#!/bin/bash
#
# Watches the folder or files passed as arguments to the script and when it
# detects a change it automatically refreshes the current selected Chrome tab or
# window.
#
# http://razius.com/articles/auto-refreshing-google-chrome-on-file-changes/
#
# Usage:
# ./chrome-refresh.sh /folder/to/watch /some/folder/file_to_watch.html
Handlebars is a semantic web template system, started by Yehuda Katz in 2010.
Handlebars.js is a superset of Mustache, and can render Mustache templates in addition to Handlebars templates.
More: http://handlebarsjs.com/
1. Expressions.
1.1 Basic usage.
@chase
chase / .ctags
Last active December 4, 2020 11:52 — forked from jesstelford/.ctags
--langdef=moonscript
--langmap=moonscript:.moon
--regex-moonscript=/(^|=[ \t])*class ([A-Za-z_][A-Za-z0-9_]+\.)*([A-Za-z_][A-Za-z0-9_]+)( extends ([A-Za-z][A-Za-z0-9_.]*)+)?$/\3/c,class/
--regex-moonscript=/^[ \t]*@?(([A-Za-z][A-Za-z0-9_.]*)+):.*[-=]>.*$/\1/m,method/
--regex-moonscript=/^[ \t]*(([A-Za-z][A-Za-z0-9_.]*)+)[ \t]*=.*[-=]>.*$/\1/f,function/
--regex-moonscript=/^[ \t]*(([A-Za-z][A-Za-z0-9_.]*)+)[ \t]*=[^->\n]*$/\1/v,variable/
--regex-moonscript=/^[ \t]*@(([A-Za-z][A-Za-z0-9_.]*)+)[ \t]*=[^->\n]*$/\1/p,property/
--regex-moonscript=/^[ \t]*@(([A-Za-z][A-Za-z0-9_.]*)+):[^->\n]*$/\1/s,static property/
--regex-moonscript=/^[ \t]*(([A-Za-z][A-Za-z0-9_.]*)+):[^->\n]*$/\1/p,property/
--regex-moonscript=/(new:[ \t]*\()@(([A-Za-z][A-Za-z0-9_.]*)+)([ \t]*=[ \t]*[^,)]+)?/\3/p,property/
@rueycheng
rueycheng / GNU-Make.md
Last active June 2, 2024 10:56
GNU Make cheatsheet
@bpj
bpj / pandoc-quote-styles.pl
Last active November 14, 2017 12:56
pandoc-quote-styles.pl - Use custom smart quotes in Pandoc
#!/usr/bin/env perl
# version 0.4
use utf8;
use autodie 2.29;
use 5.010001;
use strict;
use warnings;
use warnings qw(FATAL utf8);
@hmenke
hmenke / matheval.lua
Last active February 29, 2020 21:10
Simple mathematical expression parser and evaluator in Lua with LPEG
local lpeg = require"lpeg"
local C, P, R, S, V = lpeg.C, lpeg.P, lpeg.R, lpeg.S, lpeg.V
local white = S(" \t") ^ 0
local digit = R("09")
local dot = P(".")
local eE = S("eE")
local sign = S("+-")^-1
local mantissa = digit^1 * dot * digit^0 + dot * digit^1 + digit^1
@K4zuki
K4zuki / pandoc-new-table.md
Last active June 1, 2022 12:01
Personal note of Pandoc's **NEW** Table structure in Lua (WIP!)

Applies to Pandoc ≥ 2.10

From my notes during preparation of my filter compatibility for 2.10

See here for primary reference

-t native always gives great hints

Try:

$ pandoc -t native
| table |
|-------|
@bpj
bpj / attr-color.lua
Last active February 12, 2024 08:11
A Pandoc filter which sets LaTeX text/background/frame color(s) on Span and Div elements based on Pandoc attributes.
--[==============================[
# attr-color.lua
A Pandoc filter which sets LaTeX text/background/frame color(s) on
Span and Div elements based on Pandoc attributes.
## Usage
See https://git.io/JI4yA