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 ProfileAttributeProvider | |
def initialize(model) | |
@model = model | |
end | |
def call | |
ProfileField.all.map do |field| | |
ActiveDynamic::AttributeDefinition.new(field.name, field.datatype) | |
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
// @flow | |
const isStringEmpty = (str?: string) => { | |
return str && str.trim() !== "" | |
} | |
const first = isStringEmpty(null) | |
const second = isStringEmpty("") | |
const third = isStringEmpty("test") |
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
// @flow | |
const isStringEmpty = (str?: string): boolean => { | |
return Boolean(str && str.trim() !== "") | |
} | |
const first = isStringEmpty(null) | |
const second = isStringEmpty("") | |
const third = isStringEmpty("test") |
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
// @flow | |
const SIZE = Object.freeze({ | |
LARGE: "large", | |
MEDIUM: "medium", | |
SMALL: "small" | |
}) | |
type ISize = $Values<typeof SIZE> | |
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
// @flow | |
export type IProps = {| | |
+title: string, | |
+description?: string, | |
|} | |
class Post extends React.Component<IProps, {}> { | |
componentDidMount() { |
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
// @flow | |
const SIZE = Object.freeze({ | |
LARGE: "large", | |
MEDIUM: "medium", | |
SMALL: "small" | |
}) | |
type ISize = $Values<typeof SIZE> |
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
// @flow | |
const SIZE = /*::Object.freeze(*/{ | |
LARGE: "large", | |
MEDIUM: "medium", | |
SMALL: "small" | |
} | |
}/*::)*/ | |
type ISize = $Values<typeof SIZE> |
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
FILES_WITHOUT_FLOW="$(grep -r --include=\*.js -L "@flow" src)" | |
FILES_COUNT=$(echo $FILES_WITHOUT_FLOW | wc -w) | |
if [ $FILES_COUNT -ne 0 ] | |
then | |
echo "Following files are missing @flow annotation:" | |
echo $FILES_WITHOUT_FLOW | tr " " "\n" | |
exit 1 | |
fi |
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
defmodule AdventOfCode.Day01 do | |
def solve(part) when part == :one do | |
nums = parse_input() | |
init = delta(Enum.at(nums, 0), Enum.at(nums, -1)) | |
Enum.chunk_every(nums, 2, 1, :discard) | |
|> Enum.reduce(init, fn([a, b], acc) -> | |
acc + delta(a, b) | |
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
import React from 'react' | |
import { ThemeProvider } from 'styled-components' | |
import theme from 'styles/theme' | |
const App = () => ( | |
<ThemeProvider theme={theme}> | |
/* your components */ | |
</ThemeProvider> | |
) |
OlderNewer