Skip to content

Instantly share code, notes, and snippets.

@curioussavage
curioussavage / editor.py
Created November 16, 2022 20:25
Adam_w editory exercise
from enum import Enum
class ActionType(Enum):
ADD = 1
EDIT = 2
DEL = 3
class Action:
def __init__(self, t, data=""):
self.t = t
@curioussavage
curioussavage / app._hs
Last active January 26, 2022 22:26
hyperscript context script
def incidentApp.init()
log "hello world"
end
Broker URL: qemu+unix:///session
Domain: boxes-unknown
UUID: 58d9bb11-c2ab-4639-9187-c079d5ef0215
Persistent: yes
Cpu time: 0
Memory: 2097152 KiB
Max memory: 8037428 KiB
CPUs: 4
State: GVIR_DOMAIN_STATE_SHUTOFF
@curioussavage
curioussavage / userconf.lua
Created September 18, 2017 03:13
luakit config
local modes = require "modes"
modes.add_binds("normal", {
{ "L", "Go to next tab.", function (w) w:next_tab() end },
{ "H", "Go to previous tab.", function (w) w:prev_tab() end },
{ "J", "Go back in the browser history `[count=1]` items.", function (w, m) w:back(m.count) end },
{ "K", "Go forward in the browser history `[count=1]` times.", function (w, m) w:forward(m.count) end },
})
@curioussavage
curioussavage / bling.js
Created August 4, 2016 17:17 — forked from paulirish/bling.js
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
-- **** copied from https://gist.github.com/spartanatreyu/850788a0441e1c5565668a35ed9a1dfc **** --
--required to be non zero for dragging windows to work some weird timing issue with hammerspoon fighting against osx events
hs.window.animationDuration = 0.00000001
--flag for dragging, 0 means no drag, 1 means dragging a window, -1 means dragging but not dragging the window
dragging = 0
--the window being dragged
dragging_window = nil
@curioussavage
curioussavage / promiseError.js
Last active September 2, 2015 20:33
Just an a demonstration of error catching with promises.
function loggedFrom(from) {
return function(arg) {
console.log(from, arg);
}
}
var loggedFromCatch = loggedFrom('catch: ');
var loggedFromCallback = loggedFrom('second Callback: ');
function doSomething() {
return new Promise(function(resolve, reject) {
var source = require('vinyl-source-stream');
var gulp = require('gulp');
var gutil = require('gulp-util');
var browserify = require('browserify');
var reactify = require('reactify');
var watchify = require('watchify');
var notify = require("gulp-notify");
var scriptsDir = './scripts';
var buildDir = './build';
var source = require('vinyl-source-stream');
var gulp = require('gulp');
var gutil = require('gulp-util');
var browserify = require('browserify');
var reactify = require('reactify');
var watchify = require('watchify');
var notify = require("gulp-notify");
var scriptsDir = './scripts';
var buildDir = './build';

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