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 Scheduled::ExtractAddressesBatchJob | |
include Sidekiq::Worker | |
sidekiq_options lock: :until_and_while_executing | |
def perform | |
sites = Site | |
.select(:id) | |
.addresses_not_checked | |
.limit(10_000) | |
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
Annotation = Struct.new(:label, :start_offset, :end_offset) | |
LABELS = { 1 => 'address', 3 => 'po_box' } | |
class Snippet | |
attr_reader :text, :annotations | |
def initialize(text: '', annotations:, **other) | |
@text = text | |
@annotations = annotations |
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 React from "react"; | |
import { StyleSheet, Text, View, ScrollView } from "react-native"; | |
import { List, ListItem, Badge } from "react-native-elements"; | |
import ConfidenceBadge from "./ConfidenceBadge"; | |
import ErrorMessage from "./ErrorMessage"; | |
const textDetections = [ | |
{ | |
text: "the quick brown", | |
confidence: 89 |
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 Amplify, { API } from "aws-amplify"; | |
import awsExports from "./aws-exports"; | |
Amplify.configure({ | |
...awsExports, | |
API: { | |
endpoints: [ | |
{ | |
name: "rekognition", | |
endpoint: "https://rekognition.ap-southeast-2.amazonaws.com", |
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 React from "react"; | |
import { StyleSheet, Text, View, TouchableOpacity } from "react-native"; | |
import { Camera, Permissions } from "expo"; | |
import { Icon } from "react-native-elements"; | |
import TextDetectingCamera from "./src/TextDetectingCamera"; | |
import DetectedTextList from "./src/DetectedTextList"; | |
import ErrorMessage from "./src/ErrorMessage"; | |
export default class App extends React.Component { |
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 React from "react"; | |
import { StyleSheet, Text, View, TouchableOpacity } from "react-native"; | |
import { Icon } from "react-native-elements"; | |
import { Camera } from "expo"; | |
import Loader from "./Loader"; | |
class TextDetectingCamera extends React.Component { | |
state = { loading: false }; | |
constructor(props) { |
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 React from "react"; | |
import { Badge } from "react-native-elements"; | |
const ConfidenceBadge = ({ confidence }) => { | |
let color = "green"; | |
if (confidence < 80) color = "orange"; | |
if (confidence < 60) color = "red"; | |
return ( | |
<Badge |
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
public static void insertObjectMapper(string sProcName, List<T> entities) | |
{ | |
Type type = typeof(T); | |
PropertyInfo[] properties = typeof(T).GetProperties(); | |
string[] paramNames = null; | |
using (SqlCommand command = new SqlCommand(sProcName, Connection)) | |
{ | |
command.CommandType = CommandType.StoredProcedure; | |
SqlCommandBuilder.DeriveParameters(command); |
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
public static List<T> loadFromReader(string sProcName) | |
{ | |
List<T> EntityCollection = new List<T>(); | |
Type type = typeof(T); | |
PropertyInfo[] properties = typeof(T).GetProperties(); | |
using (Connection) | |
{ | |
SqlCommand command = new SqlCommand(sProcName); | |
command.CommandType = CommandType.StoredProcedure; |
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
puts (1..100).inject(&:*).to_s.split("").map(&:to_i).inject(&:+) |