Skip to content

Instantly share code, notes, and snippets.

View ryanpcmcquen's full-sized avatar

Ryan McQuen ryanpcmcquen

View GitHub Profile
--[[
JavaScript:
--]]
standard = '/usr/local/bin/node /usr/local/bin/standard --fix '
-- Format JavaScript with the 'Compile' command.
textadept.run.compile_commands.javascript = standard .. ' "%f"'
-- Format JavaScript before save:
events.connect(

If you are receiving an error like this in Steam:

libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
Steam: An X Error occurred
X Error of failed request:  GLXBadContext
Major opcode of failed request:  152
Serial number of failed request:  50
xerror_handler: X failed, continuing
Steam: An X Error occurred
@ryanpcmcquen
ryanpcmcquen / sanity.sh
Created January 31, 2019 23:19
Reset file permissions to sane defaults.
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
@ryanpcmcquen
ryanpcmcquen / validate_addresses.js
Created January 23, 2019 16:36
Validate address using the Nominatim OpenStreetMap API.
const fs = require('fs')
/* global fetch */
require('isomorphic-fetch')
const path = require('path')
fs.readFile(process.argv[2], 'utf8', (err, data) => {
if (err) {
return console.log(err)
}
const addresses = JSON.parse(data)
@ryanpcmcquen
ryanpcmcquen / combineTables.lua
Last active November 14, 2021 22:33
Kind of like `Object.assign()` for Lua.
local function combineTables(...)
local combinedTable = {}
local arg = {...}
for k, v in pairs(arg) do
if type(v) == 'table' then
for tk, tv in pairs(v) do
table.insert(combinedTable, tv)
end
end
@ryanpcmcquen
ryanpcmcquen / darkify_slack.sh
Last active February 23, 2023 16:08
Darkify your Slack.
#!/bin/sh
# Darkify Slack on Mac OS or Linux.
# curl https://gist.githubusercontent.com/ryanpcmcquen/8a7ddc72460eca0dc1f2dc389674dde1/raw/darkify_slack.sh | sh
if [ "`uname -s`" = "Darwin" ]; then
SLACK_INTEROP_JS="/Applications/Slack.app/Contents/Resources/app.asar.unpacked/dist/ssb-interop.bundle.js"
else
SLACK_INTEROP_JS="/usr/lib/slack/resources/app.asar.unpacked/dist/ssb-interop.bundle.js"
fi
@ryanpcmcquen
ryanpcmcquen / .bash_profile
Last active May 26, 2021 06:33
Funky configs
# So I know where I am in repos:
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# Colorize `ls` by default:
alias ls='ls -G'
[ -e ~/.bash_SECRETS ] && . ~/.bash_SECRETS
fetch('https://api.surlatable.com/stores/')
.then((response) => response.json())
.then((data) =>
console.log(
JSON.parse(data.body)
.Items.reduce((culinaryList = [], store) => {
if (
Object.keys(store.culinary).length &&
store.culinary.cookingClasses.toLowerCase() !== 'no'
) {
const gradingStudents = (grades) => {
return grades.map(
grade => {
switch (true) {
case grade < 38:
return grade
case (grade % 5) > 2:
return grade + (5 - (grade % 5))
default:
return grade