Skip to content

Instantly share code, notes, and snippets.

import cv2
import math
# Input example: /home/b1rd/pyexample/Berneys4.jpg 45 0.5 1
def transform(image, a, c, i):
img = cv2.imread(image)
rows,cols, ch = img.shape
croppedWidth, croppedHeight = map(int, rect_max_area(cols, rows, math.radians(a)))
const getColor_ = ({active, activeColor, inactiveColor, theme}) => {
if (typeof active === 'undefined') {
return theme.blueHighlight
}
return active ? activeColor || theme.blueHighlight :
inactiveColor || theme.inactiveButton
}
defmodule Words do
@doc """
Count the number of words in the sentence.
Words are compared case-insensitively.
"""
@spec count(String.t) :: map
def count(sentence) do
String.split(String.downcase(sentence), ~r/[^[:alnum:]\-]+/u, trim: true)
|>Enum.reduce(%{}, fn(tag, acc) -> Map.update(acc, tag, 1, &(&1+1))end)