This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from enum import Enum | |
class Color(Enum): | |
RED = "RED" | |
GREEN = "GREEN" | |
BLUE = "BLUE" # I just added this | |
def handle_color(color: Color): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_float(num: str | float): | |
match (num): | |
case str(num): | |
return float(num) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from enum import Enum | |
from typing import NoReturn | |
class Color(Enum): | |
RED = "RED" | |
GREEN = "GREEN" | |
BLUE = "BLUE" # I just added this | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Jurisdiction < ApplicationRecord | |
# ... | |
class << self | |
memoize def find_via(slug:) | |
Jurisdiction.find_by(slug: slug) | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(define (clean-up s) | |
(first (split-into-sentences (fix-hyphenation (fix-whitespace s))))) | |
(define (fix-whitespace s) | |
(string-replace s "\n" " ")) | |
(define (fix-hyphenation s) | |
(string-replace s "- " "")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return (1..5) | |
.map{|n| "car-#{n}"} | |
.select{|m| car_is_empty(m)} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let car_ids = []; | |
for (let i = 1; i <= 5; i++) { | |
const car_id = `car-${i}`; | |
if (car_is_empty(car_id)) { | |
car_ids.push(car_id); | |
} | |
} | |
return car_ids; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AttributeWriter { | |
constructor(cf_object) { | |
this.cf_object = cf_object; | |
} | |
async element(element) { | |
const data = this.cf_object; | |
// Is the visitor in the VIP list? | |
const visitor_asn = data.asn |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################ | |
# Each Article has a title and a number. | |
# But three of them are very difficult to parse. | |
################################################ | |
# Map Article titles to corrected numbers. | |
EXCEPTIONS = { | |
"Elements of Crimes": "9", | |
"Ne bis in idem": "20", | |
"Individual criminal responsibility": "25" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ignore static version of the site (used to upload error pages to S3 for Heroku errors) | |
/out |