Skip to content

Instantly share code, notes, and snippets.

Avatar

Ry4an Brase Ry4an

View GitHub Profile
View gist:1792078
// the solution
// 1. declare the class Number(Int)
// 2. define method Number.inc(): Number
// 3. define method Number.dec(): Number
// 4. define getNumber():Int
class Number(val n : Int) { // n cannot be changed!
def inc(): Number = new Number(n + 1)
View gist:2715764
#!/bin/bash
THIS_FOLDER=`dirname $0`
node=$1
# What files have changed
files=`hg log --template="{files}" -r $node`
# Check each
for file in $files; do
@Ry4an
Ry4an / cors-nginx.conf
Last active Nov 5, 2020 — forked from alexjs/cors-nginx.conf
Here' the minimal Access-Control-Allow-Origin header insertion necessary to allow any whitelisted sites to access resources via CORS headers.
View cors-nginx.conf
#
# Minimal CORS config for nginx
#
# A modification of https://gist.github.com/alexjs/4165271
#
# NB: This relies on the use of the 'Origin' HTTP Header.
location /static {
if ($http_origin ~* (whitelist\.address\.one|whitelist\.address\.two)$) {