Skip to content

Instantly share code, notes, and snippets.

View bryanbuchanan's full-sized avatar

Bryan Buchanan bryanbuchanan

View GitHub Profile
title: Mesa # Human-readable theme name to be used in UI
name: mesa # camelCase theme name to be used by system
image: image.jpg # Name of theme preview image file
options: # List of categories of customizable properties
- name: logo
title: Logo
properties:
- image: true
name: logoImage
@bryanbuchanan
bryanbuchanan / private-trello-attachment-proxy.js
Last active October 25, 2022 16:50
Make private Trello board attachments publicly-available. https://glitch.com/edit/#!/private-trello-attachment-proxy
require('dotenv').config()
const express = require('express')
const fetch = require('node-fetch')
const app = express()
app.use('/', async (req, res) => {
// Attachment URL
const attachmentURL = "https://trello.com/1/cards/5e65954f0f343116e999658f/attachments/5e67a146876719748d64057b/previews/5e67a147876719748d6405ae/download"
import os
import sys
directory = os.path.dirname(os.path.realpath(sys.argv[0]))
for dirpath, dirnames, files in os.walk(directory):
if not files:
os.rmdir(dirpath)
import os
import sys
directory = os.path.dirname(os.path.realpath(sys.argv[0]))
for subdir, dirs, files in os.walk(directory):
for filename in files:
if filename.find('old_suffix_1') > 0:
subdirectoryPath = os.path.relpath(subdir, directory)
filePath = os.path.join(subdirectoryPath, filename)
@bryanbuchanan
bryanbuchanan / cdtms.markdown
Created July 18, 2014 20:55
A Pen by Bryan Buchanan.
@bryanbuchanan
bryanbuchanan / GetShapeArea.jsx
Last active August 22, 2024 17:31
Script to find the area of shapes in Adobe Illustrator
/* Save this file with a jsx extension and place in your
Illustrator/Presets/en_US/Scripts folder. You can then
access it from the File > Scripts menu */
var decimalPlaces = 3;
if (app.documents.length > 0) {
if (app.activeDocument.selection.length < 1) {
alert('Select a path');
imgLoader = new Image();
imgLoader.onload = function(data) {
// Desired size
var max_width = 600;
var max_height = 600;
// Get image dimensions
var original_width = imgLoader.width;
var original_height = imgLoader.height;
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<!-- Test image -->
<img src="http://m1.22slides.com/bryanbuchanan/4317_image_374612.jpg" alt="Image">
@bryanbuchanan
bryanbuchanan / flickr_id_to_profile.php
Created April 23, 2013 01:52
Takes a Flickr users's ID and finds their profile on Flickr.com
<?php
if (isset($_POST)) {
// Get user ID
$user_id = $_POST['user_id'];
// Data to send to Flickr API
$data = array(
"method" => "flickr.people.getInfo",
"user_id" => $user_id,
@bryanbuchanan
bryanbuchanan / lltoXY.js
Last active December 16, 2015 10:59
Function that takes latitude/longitude of a single point and returns x/y position as plotted on an equirectangular map.
// Function
function lltoXY(options) {
var x = (options.lon + 180) * (options.width / 360);
var y = ((options.lat * -1) + 90) * (options.height / 180);
return { x: x, y: y };
}
// Usage
var position = lltoXY({
lat: 25.26,