Skip to content

Instantly share code, notes, and snippets.

View tomelam's full-sized avatar
💭
Still alive!

Tom Elam tomelam

💭
Still alive!
View GitHub Profile
@tomelam
tomelam / dc.rkt
Created August 18, 2022 10:08 — forked from ast-hugger/dc.rkt
Delimited continuations in terms of call/cc
;; Delimited continuations
#lang racket ; but will work in any Scheme (without this line)
;; There are other implementations along the same lines floating around.
;; Here we are trying to paint a more comprehensible (or at least a less
;; incomprehensible) picture by structuring the implementation as three
;; distinct layers:
;; Layer 1
@tomelam
tomelam / makefile
Created October 1, 2021 12:10 — forked from matijs/makefile
Minimalist makefile using PostCSS
# some variables
POSTCSS = ./node_modules/.bin/postcss
POSTCSS_FLAGS = --use autoprefixer autoprefixer.browsers "> 2%"
# wildcard expansion is performed only in targets and in prerequisites so here we need $(wildcard)
SOURCES = $(wildcard src/css/*.css)
# use $(SOURCES) to determine what we actually need using a bit of pattern substitution
TARGETS = $(patsubst src%, build%, $(SOURCES))
# our default target (see below)
all: $(TARGETS)
@tomelam
tomelam / Makefile
Created October 1, 2021 12:06 — forked from ecarter/Makefile
Makefile - coffee/jade/stylus
# Output Directory
OUTPUT = ../lib
all: css html js
css:
@echo "stylus => css"
@stylus \
-c \
@tomelam
tomelam / Makefile
Created October 1, 2021 12:04 — forked from jasonmelgoza/Makefile
Makefile - stylus
# Output Directory
OUTPUT = ../lib
all: css
css:
@echo "stylus => css"
@stylus \
-c \
-u nib \
@tomelam
tomelam / Makefile
Created October 1, 2021 11:28 — forked from hallettj/Makefile
Makefile for transpiling with Babel & Flow in a Node app, or in a client- or server-side shared library
# Makefile for transpiling with Babel in a Node app, or in a client- or
# server-side shared library.
.PHONY: all clean
# Install `babel-cli` in a project to get the transpiler.
babel := node_modules/.bin/babel
# Identify modules to be transpiled by recursively searching the `src/`
# directory.
@tomelam
tomelam / clipboard-polyfill-copy-to-clipboard-part-of-quoted-text.markdown
Created January 25, 2021 06:53
clipboard-polyfill Copy to Clipboard Part of Quoted Text
@tomelam
tomelam / nginxproxy.md
Created December 17, 2020 08:40 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@tomelam
tomelam / elementsfrompoint.js
Created March 17, 2020 12:26 — forked from iddan/elementsfrompoint.js
document.elementsFromPoint Polyfill
'use strict';
if (!document.elementsFromPoint) {
document.elementsFromPoint = elementsFromPoint;
}
function elementsFromPoint(x, y) {
var parents = [];
var parent = void 0;
do {
@tomelam
tomelam / csv_import_magic.js
Created July 3, 2018 19:49 — forked from ianlewis/csv_import_magic.js
A Google Apps Script for importing CSV data into a Google Spreadsheet.
// vim: ft=javascript:
/*jslint sloppy: true, vars: true, white: true, nomen: true, browser: true */
/*global SpreadsheetApp, UiApp, UrlFetchApp, Utilities */
/*
* A script to automate requesting data from an external url that outputs CSV data.
*
* Adapted from the Google Analytics Report Automation (magic) script.
* @author [email protected] (Nick Mihailovski)
* @author [email protected] (Ian Lewis)
*/
upstream zwm_app {
# Path to Unicorn SOCK file, as defined previously
server unix:/home/rails/zwm/shared/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 443 ssl http2;
server_name zwm.org.in;
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;