This file contains 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 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 typing import Generator | |
def clean_up(s: str) -> str: | |
return next(split_into_sentences(fix_hyphenation(fix_whitespace(s)))) | |
def fix_whitespace(s: str) -> str: | |
return s.replace("\n", " ") | |
def fix_hyphenation(s: str) -> str: |
This file contains 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 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 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
import String | |
defmodule StringOps do | |
def clean_up(title) do | |
title | |
|> fixWhitespace | |
|> fixHyphenation | |
|> splitIntoSentences | |
|> List.first | |
end |
This file contains 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
module StringOps | |
module_function | |
def clean_up(summary:) | |
split_into_sentences(fix_hyphenation(fix_whitespace(summary))).first | |
end | |
def fix_whitespace(a_string) | |
a_string.gsub "\n", " " | |
end |
This file contains 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
func cleanUp(s: String) -> String { | |
return splitIntoSentences(summary: fixHyphenation(s: fixWhitespace(s: s)))[0] | |
} | |
func fixHyphenation(s: String) -> String { | |
return s.replacingOccurrences(of: "- ", with: "") | |
} | |
func fixWhitespace(s: String) -> String { | |
return s.replacingOccurrences(of: "\n", with: " ") |
This file contains 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 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 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
# Elixir + Phoenix | |
FROM elixir:1.6.1 | |
# Install debian packages | |
RUN apt-get update | |
RUN apt-get install --yes build-essential inotify-tools postgresql-client | |
# Install Phoenix packages | |
RUN mix local.hex --force |