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
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))) |
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
const getColor_ = ({active, activeColor, inactiveColor, theme}) => { | |
if (typeof active === 'undefined') { | |
return theme.blueHighlight | |
} | |
return active ? activeColor || theme.blueHighlight : | |
inactiveColor || theme.inactiveButton | |
} |
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
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) |