text:
<repo_name>raaannzzz/react-native-render-HTML-modified<file_sep>/src/domNodeToHTMLString.js
import strigifyEntities from "stringify-entities";

function renderOpeningTag(tag, attributes) {
  const strAttributes = [];
  Object.keys(attributes).forEach((key) => {
    strAttributes.push(`${key}="${strigifyEntities(`${attributes[key]}`)}"`);
  });
  return `<${tag}${strAttributes.length ? " " : ""}${strAttributes.join(" ")}>`;
}

/**
 * Convert a DOM node to its HTML representation.
 *
 * @param {DOMNode} root - The root to stringify.
 * @param {Function} reporter - An optional function which will receive every
 * parsed node as 1st argument, the depth as 2d argument and the converted html
 * as 3d argument.
 */
export default function domNodeToHTMLString(root, reporter, depth = 0) {
  let html = "";
  if (root.type === "tag") {
    const strChildren = root.children.reduce((prev, curr) => {
      const convertedNode = domNodeToHTMLString(curr, reporter, depth + 1);
      return `${prev}${convertedNode}`;
    }, "");
    html = `${renderOpeningTag(root.name, root.attribs)}${strChildren}</${
      root.name
    }>`;
  } else if (root.type === "text") {
    const text = strigifyEntities(root.data);
    html = text;
  }
  typeof reporter === "function" && reporter(root, depth, html);
  return html;
}
<file_sep>/src/index.js
import HTML from "./HTML";

export { constructStyles } from "./HTMLStyles";
export {
  getParentsTagsRecursively,
  getClosestNodeParentByTag,
  IGNORED_TAGS,
} from "./HTMLUtils";
export { default as domNodeToHTMLString } from "./domNodeToHTMLString";
export default HTML;
<file_sep>/types/react-native-render-html/index.d.ts
// Type definitions for react-native-render-html 4.2
// Project: https://github.com/meliorence/react-native-render-html
// Definitions by: <NAME> <https://github.com/jsamr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.5
import { ReactNode, Component, ComponentType } from "react";
import {
  StyleProp,
  GestureResponderEvent,
  RecursiveArray,
  Falsy,
  TextStyle,
  ViewStyle,
  TextProps,
} from "react-native";

export interface BaseNode {
  type: "text" | "tag";
  next: HTMLNode | null;
  prev: HTMLNode | null;
  parent: HTMLNode | null;
  attribs: HtmlAttributesDictionary;
}
export interface HTMLTextNode extends BaseNode {
  type: "text";
  data: string;
}
export interface HTMLTagNode extends BaseNode {
  type: "tag";
  name: string;
  children: HTMLNode[];
}
export type HTMLNode = HTMLTagNode | HTMLTextNode;
export type NonRegisteredStylesProp<T> = T | Falsy | RecursiveArray<T | Falsy>;
export interface HtmlAttributesDictionary {
  [attribute: string]: string | number;
}

export interface TransientNode {
  wrapper: "Text" | "View";
  children: TransientNode[];
  attribs: HtmlAttributesDictionary;
  parent?: TransientNode;
  tagName?: string;
  data?: string;
  parentTag?: string;
  domNode: HTMLNode;
  nodeIndex: number;
}

export type PassProps
 = Pick<
  ContainerProps,
  | "WebView"
  | "onLinkPress"
  | "tagsStyles"
  | "ignoredTags"
  | "ignoredStyles"
  | "renderers"
  | "baseFontStyle"
  | "imagesInitialDimensions"
  | "html"
  | "uri"
  | "source"
  | "listsPrefixesRenderers"
  | "allowFontScaling"
  | "defaultTextProps"
  | "defaultWebViewProps"
  | "textSelectable"
  | "allowedStyles"
  | "classesStyles"
  | "computeEmbeddedMaxWidth"
  | "contentWidth"
  | "debug"
  | "emSize"
  | "ptSize"
  | "enableExperimentalPercentWidth"
  | "allowWhitespaceNodes"
> & {
  nodeIndex: number;
  transientChildren: TransientNode[];
  domNode: HTMLNode;
  parentWrapper: "Text" | "View";
  parentTag?: string;
  data?: string;
  key: string;
  renderersProps: P;
};

export type RendererFunction
 = (
  htmlAttribs: HtmlAttributesDictionary,
  children: ReactNode,
  convertedCSSStyles: NonRegisteredStylesProp<any>,
  passProps: PassProps

) => ReactNode;
export type RendererDeclaration
 =
  | RendererFunction

  | { renderer: RendererFunction
; wrapper: "Text" | "View" };
export interface RendererDictionary
 {
  [tag: string]: RendererDeclaration
;
}
export interface StylesDictionary {
  [tag: string]: NonRegisteredStylesProp<any>;
}
export interface ImageDimensions {
  width: number;
  height: number;
}

export interface RenderHTMLSourceUri {
  /**
   * The URI to load in the `HTML` component. Can be a local or remote file.
   */
  uri: string;
  /**
   * The HTTP Method to use. Defaults to GET if not specified.
   */
  method?: string;
  /**
   * Additional HTTP headers to send with the request.
   */
  headers?: object;
  /**
   * The HTTP body to send with the request. This must be a valid
   * UTF-8 string, and will be sent exactly as specified, with no
   * additional encoding (e.g. URL-escaping or base64) applied.
   */
  body?: string;
}
export interface RenderHTMLSourceInline {
  /**
   * A static HTML page to display in the HTML component.
   */
  html: string;
  /**
   * The base URL to be used for any relative links in the HTML code.
   */
  baseUrl?: string;
}

export type RenderHTMLSource = RenderHTMLSourceInline | RenderHTMLSourceUri;

export interface ContainerProps
 {
  /**
   * HTML string to parse and render.
   *
   * @deprecated Use `source` instead.
   */
  html?: string;
  /**
   * Remote HTML resource to parse and render.
   *
   * @deprecated Use `source` instead.
   */
  uri?: string;
  /**
   * The object source to render (either `{ uri }` or `{ html }`).
   */
  source?: RenderHTMLSource;
  /**
   * Specifies whether fonts should scale to respect Text Size accessibility settings
   *
   * @deprecated Use `defaultTextProps.allowFontScaling` instead.
   */
  allowFontScaling?: boolean;
  /**
   * Your custom renderers.
   */
  renderers?: RendererDictionary
;
  /**
   * Set of props accessible into your custom renderers in `passProps` (4th argument)
   */
  renderersProps?: P;
  /**
   * Your custom renderers from ul and ol bullets, see [lists prefixes](https://github.com/meliorence/react-native-render-html#lists-prefixes)
   */
  listsPrefixesRenderers?: RendererDictionary
;
  /**
   * ParserOptions for [htmlparser2](https://github.com/fb55/htmlparser2/wiki/Parser-options)
   * Optional, defaults `decodeEntities` to `true`
   */
  htmlParserOptions?: Record<string, any>;
  /**
   * Default width and height to display while image's dimensions are being retrieved.
   */
  imagesInitialDimensions?: ImageDimensions;
  /**
   * The width of the HTML content to display. If you don't pass this prop,
   * images might overflow horizontally and take up to all their physical
   * width. The recommended practice is to pass
   * `useWindowDimensions().width` minus any padding or margins.
   */
  contentWidth?: number;
  /**
   * A function which takes contentWidth as argument and returns a new width. Can return Infinity to denote unconstrained widths.
   */
  computeEmbeddedMaxWidth?: (contentWidth: number, tagName: string) => number;
  /**
   * Support for relative percent-widths. Currently, it only works for images.
   */
  enableExperimentalPercentWidth?: number;
  /**
   * Fired with the event, the href and an object with all attributes of the tag as its arguments when tapping a link
   */
  onLinkPress?: (
    event: GestureResponderEvent,
    href: string,
    htmlAttribs: HtmlAttributesDictionary
  ) => void;

  /**
   * Fired when your HTML content has been parsed. Also useful to tweak your rendering.
   *
   * @param root - The root transient node.
   * @returns The modified root.
   */
  onParsed?: (dom: HTMLNode[], root: TransientNode[]) => TransientNode[];
  /**
   * Provide your styles for specific HTML tags.
   *
   * **Important note** Do NOT use the StyleSheet API to create the styles you're going to feed to tagsStyle and classesStyles.
   * Although it might look like it's working at first, the caching logic of react-native makes it impossible for this module
   * to deep check each of your style to properly apply the precedence and priorities of your nested tags' styles.
   */
  tagsStyles?: StylesDictionary;
  /**
   * Provide your styles for specific HTML classes.
   *
   * **Important note** Do NOT use the StyleSheet API to create the styles you're going to feed to tagsStyle and classesStyles.
   * Although it might look like it's working at first, the caching logic of react-native makes it impossible for this module
   * to deep check each of your style to properly apply the precedence and priorities of your nested tags' styles.
   */
  classesStyles?: StylesDictionary;
  /**
   * Custom style for the default container of the renderered HTML.
   */
  containerStyle?: StyleProp<ViewStyle>;
  /**
   * Replace the default wrapper with a function that takes your content as the first parameter.
   */
  customWrapper?: (innerNodes: ReactNode) => ReactNode;
  /**
   * Replace the default loader while fetching a remote website's content.
   */
  remoteLoadingView?: (props: ContainerProps
, state: any) => ReactNode;
  /**
   * Replace the default error if a remote website's content could not be fetched.
   */
  remoteErrorView?: (props: ContainerProps
, state: any) => ReactNode;
  /**
   * The default value in pixels for 1em
   */
  emSize?: number;
  /**
   * The default value in pixels for 1pt
   */
  ptSize?: number;
  /**
   * The default style applied to `<Text>` components
   */
  baseFontStyle?: NonRegisteredStylesProp<TextStyle>;
  /**
   * Allow all texts to be selected. Default to `false`.
   *
   * @deprecated Use `defaultTextProps.selectable` instead.
   */
  textSelectable?: boolean;
  /**
   * Target some specific texts and change their content, see [altering content](https://github.com/meliorence/react-native-render-html#alterdata)
   */
  alterData?: (node: HTMLNode) => string | Falsy;
  /**
   * Target some specific nested children and change them, see [altering content](https://github.com/meliorence/react-native-render-html#alterchildren)
   */
  alterChildren?: (node: HTMLNode) => HTMLNode | Falsy;
  /**
   * Target a specific node and change it, see [altering content](https://github.com/meliorence/react-native-render-html#alternode)
   */
  alterNode?: (node: HTMLNode) => HTMLNode | Falsy;
  /**
   * HTML tags you don't want rendered, see [ignoring HTML content](https://github.com/meliorence/react-native-render-html#ignoring-html-content)
   */
  ignoredTags?: string[];
  /**
   * Allow render only certain CSS style properties and ignore every other. If you have some property both in `allowedStyles` and `ignoredStyles`, it will be ignored anyway.
   */
  allowedStyles?: string[];
  /**
   * CSS styles from the style attribute you don't want rendered, see [ignoring HTML content](https://github.com/meliorence/react-native-render-html#ignoring-html-content)
   */
  ignoredStyles?: string[];
  /**
   * Return true in this custom function to ignore nodes very precisely, see [ignoring HTML content](https://github.com/meliorence/react-native-render-html#ignoring-html-content)
   */
  ignoreNodesFunction?: (node: HTMLNode) => boolean;
  /**
   * Prints the parsing result from htmlparser2 and render-html after the initial render
   */
  debug?: boolean;
  /**
   * The WebView component used by plugins (iframe, table)...
   * See [@native-html/plugins](https://github.com/native-html/plugins).
   */
  WebView?: ComponentType<any>;
  /**
   * Default props for Text elements in the render tree.
   *
   * @remarks "style" will be ignored. Use `baseFontStyle` instead.
   */
  defaultTextProps?: Omit<TextProps, "style">;
  /**
   * Default props for WebView elements in the render tree used by plugins.
   */
  defaultWebViewProps?: any;
  /**
   * Allows the rendering of nodes that consist of only whitespace characters
   */
  allowWhitespaceNodes?: boolean;
}

/**
 * Returns an array with the tagname of every parent of a node or an empty array if nothing is found.
 * @param node A parsed HTML node from alterChildren for example
 */
export function getParentsTagsRecursively(node: HTMLNode): string[];

/**
 * Returns the closest parent of a node with a specific tag.
 * @param node A parsed HTML node from alterChildren for example
 * @param tag The tag to match
 */
export function getClosestNodeParentByTag(
  node: HTMLNode,
  tag: string
): HTMLNode | null;

/**
 * Helper that composes styles with the default style for a tag, the "style" attribute and
 * any given additional style. Checks everything against the style sets of views, images,
 * or texts with prop-types.
 *
 * @param params - Configuration to construct styles.
 */
export function constructStyles(params: {
  tagName: string;
  htmlAttribs: HtmlAttributesDictionary;
  passProps: PassProps<any>;
  styleSet: "VIEW" | "TEXT";
  additionalStyles?: StyleProp<any>;
  baseFontStyle?: NonRegisteredStylesProp<TextStyle>;
}): StyleProp<any>;

/**
 *
 * Convert a DOM node to its HTML representation.
 *
 * @param root - The node to stringify.
 * @param reporter? - An optional function which will receive every
 * parsed node as 1st argument, the depth as 2d argument and the converted html
 * as 3d argument.
 */
export function domNodeToHTMLString(
  root: HTMLNode,
  reporter?: (node: HTMLNode, depth: number, html: string) => void
): string;

/**
 * The set of default ignored tags
 */
export const IGNORED_TAGS: string[];

declare class HTML
 extends Component<ContainerProps
> {}

export default HTML;
<file_sep>/types/react-native-render-html/tests.tsx
import * as React from "react";
import HTML from "react-native-render-html";

// $ExpectType Element
const test = ;
<file_sep>/src/__tests__/domNodeToHTMLString.test.js
import domNodeToHTMLString from "../domNodeToHTMLString";
import { parseDOM } from "htmlparser2";

describe("domNodeToHTMLString", () => {
  it("should be bijective regarding parseDOM from htmlparser2", () => {
    const html = `<article class="aclass"><p>This is a paragraph.</p><p>This is a paragraph.</p><p>This is a paragraph.</p></article>`;
    const root = parseDOM(html);
    expect(domNodeToHTMLString(root[0])).toBe(html);
  });
  it("should call reporter argument with every parsed node", () => {
    const reporter = jest.fn();
    const html = `<article><p>This is a paragraph.</p><p>This is a paragraph.</p><p>This is a paragraph.</p></article>`;
    const root = parseDOM(html);
    domNodeToHTMLString(root[0], reporter);
    expect(reporter).toHaveBeenCalledTimes(7);
  });
  it("should handle tables", () => {
    const tableSnippet = `

      Entry Header 1
      Entry Header 2
      Entry Header 3

      Entry First Line 1
      Entry First Line 2
      Entry First Line 3

`;
    const root = parseDOM(tableSnippet);
    expect(domNodeToHTMLString(root[0])).toBe(tableSnippet);
  });
});

languages: TypeScript JavaScript TSX

repo_language: TypeScript


text:
<repo_name>marcadler/get_abs<file_sep>/get_abs.py
import os
import sys
import re
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

f = open('abstracts.txt','a') # create the textfile into which the
							  # abstracts will go

final = [] # initialize the "final" list of numbers to be processed

filenames = (os.listdir(os.curdir)) # get the names of the files
									# in the folder

def chopper(filenames):
	for i in filenames:
		if re.search(r"\w+\.doc", i): #.doc? then proceed
			chopped = re.sub(r"\w{3}_\d+_(\w+)_EWOS_\d+\.doc", r"\1", i) #keep only the middle part (pub. no.) of the file name
			final.append(chopped) # append pub. no. to final
		else: # doesn't end in .doc? skip it
			pass

def get_abs(final):
	for i in final:
		driver.get("https://patentscope.wipo.int/search/en/search.jsf")
		elem = driver.find_element_by_name("simpleSearchSearchForm:fpSearch")
		elem.clear() # so it's clear for the next iteration
		elem.send_keys(i) # send the pub. no. in final
		elem.send_keys(Keys.RETURN)
		elem = driver.find_element_by_partial_link_text('WO/20').click() # there's only ever one
		elem = driver.find_element_by_xpath('''//*[@id="detailPCTtableHeader"]/tbody/tr[position()=10 or position()=11]/td[2]/div/span/span[1]''') # xpath of abstract
		abstract_text = ("%s\t%s\n\n" % (i, elem.text)) # format
		f.write(abstract_text.encode("utf-8")) # deal with utf-8
		# TODO: Navigate to the page with the pdfs and
		#       download them into a folder inside the folder
		# elem = driver.find_element_by_link_text('Documents').click()

chopper(filenames) # get pub. nos.
driver = webdriver.Chrome() #start up the Chrome driver
get_abs(final) # get abstracts
f.close() # close the final text file
driver.quit() # close browser - has to be done after f.close()

<file_sep>/README.md
# get_abs
Python 2.7 script using Selenium. Automatically extracts pub. nos. from a list of files and retrieves corresp. Eng.-lang. abstracts from WIPO website.

branch_name: refs/heads/master

languages: Markdown Python

repo_language: Markdown


text:
<repo_name>sohaibazhar129831/attendanceManagementFrontEnd<file_sep>/src/components/admin/courses/CourseList.vue
<template>

    <v-btn @click="dialog = true" class="mt-5" color="success"
      >Add Course
    </v-btn>
    <course-dialogue v-if="dialog" @closeAddCourseDialog="dialog=false" :dialog="dialog" />
    <update-course-dialogue
      v-if="updateDialog"
      @closeUpdateCourseDialog="updateDialog=false"
      :updateDialog="updateDialog"
      :courseName="name"
      :courseCode="code"
      :id="id"
    />
    <template>
    <v-spacer />
      <v-data-table dark class="mt-5" :headers="headers" :items="Courses">
        <template v-slot:item.actions="{ item }">
          <v-icon small class="mr-2" @click="updateDialog = true,updateCourse(item)">
            mdi-pencil
          </v-icon>
          <v-icon small class="mr-2" @click="deleteCourseItem(item)">
            mdi-delete
          </v-icon>
        </template>
      </v-data-table>
    </template>

</template>
<file_sep>/src/components/LoginUser.vue
<template>
  <v-container class="mt-15">
    <v-card   class="mx-auto" width="400" outlined>
      <v-card-title   class="justify-center">LOG IN</v-card-title>
      <v-divider />
      <v-card-text >
        <v-form >
          <v-text-field v-model="user.email" outlined label="email" />
          <v-text-field
            v-model="user.password"
            outlined
            type="Password"
            label="password"
          />
        </v-form>
      </v-card-text>
      <v-divider />
      <v-card-actions>
        <v-btn  text color="blue" @click="login()">SIGN IN</v-btn>
        <v-spacer></v-spacer>
        <v-btn text color ="red" @click="register()"> SIGN UP </v-btn>
      </v-card-actions>
    </v-card>
  </v-container>
</template>
<file_sep>/src/components/admin/teachers/TeacherDialogue.vue
<template>

    <v-dialog persistent v-model="dialog" width="400">
      <v-card>
        <v-card-title class="headline blue lighten-2">
          Add Teacher
        </v-card-title>
        <v-divider></v-divider>
        <v-card-text class="mt-10">
          <v-text-field
            outlined
            label=" Name"
            v-model="teacher.name"
          ></v-text-field>
          <v-divider></v-divider>
          <v-text-field
            outlined
            label=" Email"
            v-model="teacher.email"
          ></v-text-field>
          <v-divider></v-divider>
        </v-card-text>
        <v-card-actions>
          <v-spacer></v-spacer>
          <v-btn color="red darken-1" text @click.native="close()"> Cancel </v-btn>
          <v-btn @click.native="addTeacher()" color="blue darken-1" text> OK </v-btn>
        </v-card-actions>
      </v-card>
    </v-dialog>

</template>
<file_sep>/src/components/student/SelectCourses.vue
<template>

    <v-select
      :items="Courses"
      label="Choose Course"
      outlined
      v-model="id"
      item-text="name"
      item-value="_id"
      @change="fetchStudentAttendance()"
    ></v-select>
    <v-divider></v-divider>
    <v-data-table dark :items="Students" :headers="headers"></v-data-table>

</template>
<file_sep>/src/components/admin/courses/UpdateCourseDialogue.vue
<template>

    <v-dialog persistent v-model="updateDialog" width="400">
      <v-card>
        <v-card-title class="headline red lighten-2">
          Update Course
        </v-card-title>
        <v-divider></v-divider>
        <v-card-text class="mt-10">
          <v-text-field outlined label=" Name" v-model="name"></v-text-field>
          <v-divider></v-divider>
          <v-text-field outlined label=" Code" v-model="code"></v-text-field>
          <v-divider></v-divider>
          <v-select
            multiple
            class="mt-6"
            label="Students"
            :items="Students"
            item-text="name"
            item-value="_id"
            v-model="studentIds"
            outlined
          ></v-select>
        </v-card-text>
        <v-card-actions>
          <v-spacer></v-spacer>
          <v-btn color="red darken-1" text @click.native="close()">
            Cancel
          </v-btn>
          <v-btn @click.native="updateCourse()" color="blue darken-1" text>
            Ok
          </v-btn>
        </v-card-actions>
      </v-card>
    </v-dialog>

</template>
<file_sep>/src/views/Admin.vue
<template>

    <v-tabs>
      <v-tab>
        <v-icon left> mdi-account </v-icon>
        Teachers
      </v-tab>
      <v-tab>
        <v-icon left> mdi-account </v-icon>
        Courses
      </v-tab>
      <v-tab>
        <v-icon left> mdi-account </v-icon>
        Students
      </v-tab>
      <v-tab-item>
        <teacher-list />
      </v-tab-item>
      <v-tab-item>
        <course-list />
      </v-tab-item>
      <v-tab-item>
        <student-list />
      </v-tab-item>
    </v-tabs>

</template>
<file_sep>/src/components/admin/student/UpdateStudentDialogue.vue
<template>

    <v-dialog persistent v-model="updateDialog" width="400">
      <v-card>
        <v-card-title class="headline red lighten-2">
          Update Student
        </v-card-title>
        <v-divider></v-divider>
        <v-card-text class="mt-10">
          <v-text-field outlined label=" Name" v-model="name"></v-text-field>
          <v-divider></v-divider>
          <v-text-field outlined label=" Email" v-model="email"></v-text-field>
          <v-divider></v-divider>
          <v-select
            multiple
            class="mt-6"
            label="courses"
            :items="Courses"
            item-text="name"
            item-value="_id"
            v-model="courseIds"
            outlined
          ></v-select>
        </v-card-text>
        <v-card-actions>
          <v-spacer></v-spacer>
          <v-btn color="red darken-1" text @click="close()"> Cancel </v-btn>
          <v-btn @click="UpdateStudent()" color="blue darken-1"> OK </v-btn>
        </v-card-actions>
      </v-card>
    </v-dialog>

</template>
<file_sep>/src/components/admin/teachers/UpdateTeacherDialogue.vue
<template>

    <v-dialog persistent v-model="UpdateDialog" width="400">
      <v-card>
        <v-card-title class="headline red lighten-2">
          Update Teacher
        </v-card-title>
        <v-divider></v-divider>
        <v-card-text class="mt-10">
          <v-text-field outlined label=" Name" v-model="name"></v-text-field>
          <v-divider></v-divider>
          <v-text-field outlined label=" Email" v-model="email"></v-text-field>
          <v-divider></v-divider>
          <v-select
            multiple
            class="mt-6"
            label="courses"
            :items="Courses"
            item-text="name"
            item-value="_id"
            outlined
            v-model="courseIds"
          ></v-select>
        </v-card-text>
        <v-card-actions>
          <v-spacer></v-spacer>
          <v-btn color="red darken-1" text @click="close()"> Cancel </v-btn>
          <v-btn @click="UpdateTeacher()" color="blue darken-1" text>
            OK
          </v-btn>
        </v-card-actions>
      </v-card>
    </v-dialog>

</template>
<file_sep>/src/components/admin/teachers/TeacherList.vue
<template>

    <v-btn @click="dialog = true" class="mt-5" color="success"
      >Add Teacher
    </v-btn>
    <teacher-dialogue v-if="dialog" @closeTeacherAddDialog="dialog = false" :dialog="dialog" />
    <update-teacher-dialogue
      v-if="UpdateDialog"
      @closeUpdateDialog="UpdateDialog=false"
      :UpdateDialog="UpdateDialog"
      :selectedName="name"
      :selectedEmail="email"
      :id="id"
    />
    <v-spacer />
    <template>
      <v-data-table dark class="mt-5" :headers="headers" :items="Teachers">
        <template v-slot:item.actions="{ item }">
          <v-icon small class="mr-2" @click="(UpdateDialog = true), updateTeacher(item)">mdi-pencil</v-icon>
          <v-icon small class="mr-2" @click="deleteTeacherItem(item)"> mdi-delete</v-icon>
        </template>
      </v-data-table>
    </template>

</template>
<file_sep>/src/views/Teacher.vue
<template>

    <v-divider></v-divider>
    <select-course :receive="receive" />
    <v-divider></v-divider>
    <student-details class="mt-10" :itemId="itemId" />

</template>
<file_sep>/src/components/teacher/SelectCourse.vue
<template>

    <v-card>
      <v-select
        :items="Courses"
        label="Choose Courses"
        item-text="name"
        item-value="_id"
        v-model="selectedItemId"
        outlined
        @change="receive(selectedItemId)"
      ></v-select>
    </v-card>

</template>
<file_sep>/src/views/RegisterUser.vue
<template>
    <register-user/>
</template>
<file_sep>/src/views/LoginUser.vue
<template>
    <login-user/>
</template>
<file_sep>/src/components/RegisterUser.vue
<template>
  <v-container class="mt-15">
    <v-card class="mx-auto" width="400" outlined>
      <v-card-title class="justify-center">REGISTER</v-card-title>
      <v-divider />
      <v-card-text>
        <v-form>
          <v-text-field v-model="user.name" outlined label="name" />
          <v-text-field v-model="user.email" outlined label="email" />
          <v-text-field
            v-model="user.password"
            outlined
            type="password"
            label="Password"
          />
          <v-select
            v-model="user.role"
            :items="items"
            label="REGISTER AS"
          ></v-select>
        </v-form>
      </v-card-text>
      <v-divider />
      <v-card-actions>
        <v-btn  text color="blue" @click="createPost()">REGISTER</v-btn>
      </v-card-actions>
    </v-card>
  </v-container>
</template>
<file_sep>/src/components/admin/courses/CourseDialogue.vue
<template>

    <v-dialog persistent v-model="dialog" width="450">
      <v-card>
        <v-card-title class="headline red lighten-2">
          Add Course
        </v-card-title>
        <v-divider></v-divider>
        <v-card-text class="mt-10">
          <v-text-field
            outlined
            label=" CourseName"
            v-model="course.name"
          ></v-text-field>
          <v-divider></v-divider>
          <v-text-field
            outlined
            label=" CourseCode"
            v-model="course.code"
          ></v-text-field>
          <v-divider></v-divider>
        </v-card-text>
        <v-card-actions>
          <v-spacer></v-spacer>
          <v-btn color="red darken-1" text @click.native="close()"> Cancel </v-btn>
          <v-btn @click.native="addCourse()" color="blue darken-1" text> OK </v-btn>
        </v-card-actions>
      </v-card>
    </v-dialog>

</template>
<file_sep>/src/views/Student.vue
<template>

    <select-courses />

</template>
<file_sep>/src/components/admin/student/StudentList.vue
<template>

    <v-btn @click="dialog = true" class="mt-5" color="success"
      >Add Student
    </v-btn>
    <student-dialogue
      @closeDialog="dialog = false"
      v-if="dialog"
      :dialog="dialog"
    />
    <update-student-dialogue
      v-if="updateDialog"
      :updateDialog="updateDialog"
      @closeUpdateDialog="updateDialog = false"
      :studentName="name"
      :studentEmail="email"
      :id="id"
    />
    <v-spacer />
    <template>
      <v-data-table dark class="mt-5" :headers="headers" :items="Students">
        <template v-slot:item.actions="{ item }">
          <v-icon
            small
            class="mr-2"
            @click="(updateDialog = true),updateStudent(item)"
          >
            mdi-pencil
          </v-icon>
          <v-icon small class="mr-2" @click="deleteStudentItem(item)">
            mdi-delete
          </v-icon>
        </template>
      </v-data-table>
    </template>

</template>
<file_sep>/src/components/teacher/StudentDetails.vue
<template>

    <template>
      <v-data-table
        :headers="headers"
        :items="Students"
        :items-per-page="5"
        class="mt-5"
        dark
      >
        <template #item.isPresent="{ item }">
          <v-checkbox
            @change="markAttendance(item.id, item.isPresent)"
            v-model="item.isPresent"
          >
          </v-checkbox>
        </template>
      </v-data-table>
    </template>

</template>
<file_sep>/src/components/admin/student/StudentDialogue.vue
<template>

    <v-dialog persistent v-model="dialog" width="400">
      <v-card>
        <v-card-title class="headline green lighten-2">
          Add Student
        </v-card-title>
        <v-divider></v-divider>
        <v-card-text class="mt-10">
          <v-text-field
            outlined
            label=" Name"
            v-model="student.name"
          ></v-text-field>
          <v-divider></v-divider>
          <v-text-field
            outlined
            label=" Email"
            v-model="student.email"
          ></v-text-field>
          <v-divider></v-divider>
        </v-card-text>
        <v-card-actions>
          <v-spacer></v-spacer>
          <v-btn color="red darken-1" text @click="close()">
            Cancel
          </v-btn>
          <v-btn @click.native="addStudent()" color="blue darken-1" text>
            OK
          </v-btn>
        </v-card-actions>
      </v-card>
    </v-dialog>

</template>
<file_sep>/src/components/shared/Header.vue
<template>

    <v-toolbar plain color="primary" dark>
      <v-toolbar-title>{{title}}  </v-toolbar-title>
      <v-toolbar-title>{{titleb}}</v-toolbar-title>
      <v-toolbar-title>{{titlec}}</v-toolbar-title>
      <v-spacer></v-spacer>
      <v-btn outlined @click="logOut()"> LOG OUT</v-btn>
    </v-toolbar>

</template>

branch_name: refs/heads/main

repo_language: Vue


text:
<repo_name>tomostock/my-app2<file_sep>/src/Nav.js

import React, {useContext} from 'react';
import { Link } from 'react-router-dom';
import MenuItem from '@material-ui/core/MenuItem';
import { makeStyles } from '@material-ui/core/styles';
import MailIcon from '@material-ui/icons/Mail';
import GamepadIcon from '@material-ui/icons/Gamepad';
import AssignmentIndIcon from '@material-ui/icons/AssignmentInd';
import HomeIcon from '@material-ui/icons/Home';
import MenuBookIcon from '@material-ui/icons/MenuBook';
import { AuthContext } from "./auth/AuthProvider";
import { TittleAlarm } from "./Game";

const useStyles = makeStyles({
  link: {
    textDecorationLine: 'none',
    color: 'white'
  },
  listItem: {
    fontFamily: ['"Noto Serif"','"Shippori Mincho B1"', 'serif'],
    minHeight: '50px',
    color: ' white',
  },
  flistItem: {
    fontFamily: ['"Noto Serif"','"Shippori Mincho B1"', 'serif'],
    minHeight: '36px',
    color: '#0a1612',
    width: '88px',
    display: 'grid',
    justifyContent: 'center',
    textAlign: '-webkit-center',
  },
  icon: {
    fontSize: 40
  },
  drowermenu: {
    marginTop: '48px',
    marginLeft: '16px'
  },
  flex: {
    display: 'flex',
    justifyContent: 'space-between'
  },
  fnavName: {
    textAlign: 'center',
    fontSize: '15px',
    color: '#0a1612',
    fontStyle: 'italic',
    background: 'linear-gradient(transparent 80%, #f7ce3e 60%)',
    marginTop: '-2px',
    transform: 'rotate(-5deg)',
    borderRadius: '2px'
  }
});

function GameTittle() {
  TittleAlarm();
}

function Nav() {
  const classes = useStyles();
  const { currentUser } = useContext(AuthContext);
  return (

        <Link to="/"className={classes.link}>
          <MenuItem className={classes.listItem}><HomeIcon className={classes.yIcon}/>　Top</MenuItem>
        </Link>
        <Link to="/Profile"className={classes.link}>
          <MenuItem className={classes.listItem}><AssignmentIndIcon />　Profile</MenuItem>
        </Link>
        <Link to="/Game"className={classes.link}>
          { currentUser ?
            <MenuItem className={classes.listItem} onClick={GameTittle}><GamepadIcon />　Game</MenuItem>
            : <MenuItem className={classes.listItem} ><GamepadIcon />　Game</MenuItem> }
        </Link>
        <Link to="/Book"className={classes.link}>
          <MenuItem className={classes.listItem}><MenuBookIcon />　Lylic</MenuItem>
        </Link>
        <Link to="/Contact"className={classes.link}>
          <MenuItem className={classes.listItem}><MailIcon />　Mail</MenuItem>
        </Link>

  );
}

export function Fnav() {
  const classes = useStyles();
  const { currentUser } = useContext(AuthContext);
  return (

      <Link to="/Profile"className={classes.link}>
        <MenuItem className={classes.flistItem}>
          <AssignmentIndIcon className={classes.icon} />

Profile

        </MenuItem>
      </Link>
      <Link to="/Game"className={classes.link}>
      { currentUser ?
        <MenuItem className={classes.flistItem} onClick={GameTittle}>
          <GamepadIcon className={classes.icon} />

Game

        </MenuItem> :
        <MenuItem className={classes.flistItem} >
          <GamepadIcon className={classes.icon} />

Game

        </MenuItem> }
      </Link>
      <Link to="/Book"className={classes.link}>
        <MenuItem className={classes.flistItem}>
          <MenuBookIcon className={classes.icon} />

Lylic

        </MenuItem>
      </Link>
      <Link to="/Contact"className={classes.link}>
        <MenuItem className={classes.flistItem}>
          <MailIcon className={classes.icon} />

Mail

        </MenuItem>
      </Link>

  );
}

export default Nav;<file_sep>/src/Send.js

import Button from '@material-ui/core/Button';

const Send = () => {
  return (

Mail Sended

      <Button variant="contained" color="primary" href="./">Top</Button>

  );
};

export default Send;
<file_sep>/src/Profile.js
import React from 'react';
import './css/profile.css';

export default function Profile() {
  return (

PROFILE

about this APP

Deploy: Heroku

Auth: FireBase

Ui: Material-UI

Mail: emailjs

Game: React Tutorial

about Auther

Name: <NAME>

Address: Sagamihara city, Kanagawa

Birth: 1977 at Shibuya city, Tokyo

Mail: <EMAIL>

Develop Experienced: about 12y

      ※Please contact me by email for job history

  );
}<file_sep>/src/Game.js
import React from 'react';
import Button from '@material-ui/core/Button';
import ReactDOM from 'react-dom';
import './css/game.css';
import SBtn from './sound/button.mp3'
import SDrum from './sound/dog.mp3'
import Pb from './img/piece_b.png'
import Pw from './img/piece_w.png'
import BAW from './img/blackandwhite.png'

class Board extends React.Component {
  renderSquare(i) {
    return (
      <Square
        value={
          this.props.squares[i] ?
            this.props.squares[i] === 'o' ?  :
            : ''
        }
        onClick={() => this.props.onClick(i)}
        isHighlight={ this.props.winLine.includes(i) }
        key={i}
      />
    );
  }

  render() {
    const boardSquares = [[0, 1, 2], [3, 4, 5], [6, 7, 8]];
    return (

        {
          boardSquares.map((rowSquares, i) => {
            return(

                {
                  rowSquares.map((square) =>{
                    return(this.renderSquare(square))
                  })
                }

            )
          })
        }

    );
  }
}

class Game extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      history: [{
        squares: Array(9).fill(null)
      }],
      stepNumber: 0,
      oIsNext: true,
      prevCount: 1
    };
  }

  handleClick(i) {
    const audio = new Audio(SBtn);
    audio.play();
    alarm();

    const history = this.state.history.slice(0, this.state.stepNumber + 1);
    const current = history[history.length - 1];
    const squares = current.squares.slice();
    if (calculateWinner(squares) || squares[i]) {
      return;
    }
    squares[i] = this.state.oIsNext ? 'o' : 'x';
    this.setState({
      history: history.concat([{
        squares: squares
      }]),
      stepNumber: history.length,
      oIsNext: !this.state.oIsNext,
      prevCount: this.state.prevCount
    });
  }

  jumpTo(step) {
    document.getElementById("cap").style.display ="none";
    document.getElementById("overlay").style.display ="block";
    this.setState({
      stepNumber: step,
      oIsNext: (step % 2) === 0,
      prevCount: this.state.prevCount + 1
    })
  }

  prev_btn(stepNumber) {
    if( this.state.stepNumber > 0 && this.state.stepNumber < 9 ) {
      return(
        <Button variant="contained" color="primary" onClick={() => this.jumpTo(stepNumber-1)} className="button">
          Back
        </Button>
      );
    } else {
      return(
        <Button variant="contained" color="primary" className="button"　disabled>Back</Button>
      );
    }
  }

  render() {
    const history = this.state.history;
    const current = history[this.state.stepNumber];
    const winner = calculateWinner(current.squares);
    const moves = history.map((step, move) => {
      const desc = move ? '' : 'Reset';
      return(

          { move === 0 ?
            <Button variant="contained" color="primary" onClick={() => this.jumpTo(move)} className="history">
              { desc }
            </Button>
            : ""
          }

      );
    });

    let status;
    let winLine = [];

    if (winner) {
      status = winner.player === 'o' ? 'Winner:Black' : 'Winner:White';
      winLine = winner.line;
      document.getElementById("overlay").style.display ="none";
      document.getElementById("cap").style.display ="block";
      const audio = new Audio(SDrum);
      audio.play();
    } else {
      status = 'Next: ' + (this.state.oIsNext ? 'Black' : 'White');
      if( this.state.stepNumber === 9) {
        status = "Draw";
        winLine = [0,1,2,3,4,5,6,7,8]
        document.getElementById("overlay").style.display ="none";
        document.getElementById("cap").style.display ="block";
      }
    }

    return (

{status}

          <Board
            squares={current.squares}
            onClick={(i) => this.handleClick(i)}
            winLine={winLine}
          />

{this.prev_btn(this.state.stepNumber)}

{moves}

{status}

    );
  }
}
export default Game;

export function GameStart() {
    return (

Black & White

    );
}
// ========================================

ReactDOM.render(
  <Game />,
  document.getElementById('root')
);

function Square(props) {
  return (
    <button
      className={ props.isHighlight ? "square highlight-color" : "square" }
      onClick={props.onClick}
    >
      {props.value}
    </button>
  );
}

function calculateWinner(squares) {
  const lines = [
    [0, 1, 2],
    [3, 4, 5],
    [6, 7, 8],
    [0, 3, 6],
    [1, 4, 7],
    [2, 5, 8],
    [0, 4, 8],
    [2, 4, 6],
  ];
  for (let i = 0; i < lines.length; i++) {
    const [a, b, c] = lines[i];
    if (squares[a] && squares[a] === squares[b] && squares[a] === squares[c]) {
      return { player: squares[a], line: [a, b, c] };
    }
  }
  return null;
}

export function TittleAlarm() {
  document.getElementById("tittle").style.display ="flex";
  setTimeout(function() {
   document.getElementById("tittle").style.display ="none";
  }, 3000);
}

function alarm() {
  const overlay = document.getElementById("overlay");
  overlay.classList.toggle('overlay-on');
  setTimeout(function() {
    overlay.classList.toggle('overlay-on');
  }, 1500);
}

<file_sep>/src/css/Book.css
.lylic {
  width: 100%;
  text-align: center;
}
.stf__item {
  background-color: #FFF;
  text-align: center;
  border: 1px solid #dcdcdc;
  line-height: 2;
  font-size: 15px;
}
.page {
  border: 1px solid #dcdcdc;
}

.pageNum {
  font-size: 8px;
  text-align: right;
  position: absolute;
  bottom: 0px;
  right: 4px;
}

h3 {
  font-size: 24px;
}

.note {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 20px;
  background: #c5c1c0;
}<file_sep>/src/MyAccount.js
import React from 'react';
import { app } from "./base.js";
import './css/auth.css';

export default function MyAccount() {
  const user = app.auth().currentUser;
  console.log(user);
  return (

My Account %&!#$%&!#

        Email:

        {user.email}

        Last Sign In:

        {user.metadata.lastSignInTime}

        Create Date:

        {user.metadata.creationTime}

  );
}<file_sep>/src/Contact.js
import React from 'react';
import emailjs from 'emailjs-com';
import Button from '@material-ui/core/Button';
import './css/contact.css';
import { FormControl, InputLabel, Input, TextField } from '@material-ui/core';
import { createHashHistory } from "history";

export default function Contact() {
  function sendEmail(e) {
    e.preventDefault();

    emailjs.sendForm('service_2kci3ph', 'template_3bezrgm', e.target, 'user_Vk8nUBq1NqqxNXtLLROy0')
      .then((result) => {
        alert(result.text);
        const history = createHashHistory();
        history.go();
      }, (error) => {
        alert(error.text);
      });
  }

  return (

Contact

        <form className="contact-form" onSubmit={sendEmail}>
          <input type="hidden" name="contact_number" />
          <FormControl>
            <InputLabel>
              Name
            </InputLabel>
            <Input name="user_name" type="text" placeholder="name" />
          </FormControl>
          <FormControl>
            <InputLabel>
              Email
            </InputLabel>
            <Input name="user_email" type="email" placeholder="email" />
          </FormControl>
          <FormControl>
            <TextField
              id="filled-multiline-static"
              label="message"
              multiline
              rows={4}
              name="message"
            />
          </FormControl>
          <Button variant="contained" color="primary" type="submit">Send to Auther</Button>
        </form>

  );
}

languages: JavaScript CSS

repo_language: JavaScript


text:
<repo_name>tozetti13/tozetti13.github.io<file_sep>/firstry/README.md
# tozetti13.github.io
Dupla:
<NAME>
<NAME>ior

Atividade 1 ->
<file_sep>/README.md
# tozetti13.github.io
HTML5 Portf
<file_sep>/worker/ordena.js
var inic = 0;
var fim = 0;
var tempexec = 0;

document.getElementById("inputNumber").autofocus;

var bubble = new Worker('bubble.js');
bubble.addEventListener('message', function(e) {
	$("#tempo").empty();
	$("#tempo").append("0");
    fim = new Date().getTime();
    tempexec = parseFloat((fim - inic)/1000);
    var tamanho = document.getElementById("inputNumber").value;
    document.getElementById("tempo").innerHTML = tempexec + " segundos para ordenar o vetor de " + tamanho + " posições";
    console.log('Worker said: ', e.data);
}, false);

function teste() {
    inic = new Date().getTime();
    var tamanho = document.getElementById("inputNumber").value;
    var array = [];
    for (var i = 0; i < tamanho; i++) {

        array[i] = randomNumber();
    }
    $(".tmp").empty();
    $(".tmp").append("

");
    bubble.postMessage(array);

};

function randomNumber() {
    return parseInt((Math.random() * 100), 10)
}

function bubbleSort(a) {
    var ord;
    do {
        ord = false;
        for (var i = 0; i  a[i + 1]) {
                var temp = a[i];
                a[i] = a[i + 1];
                a[i + 1] = temp;
                ord = true;
            }
        }
    } while (ord);
}

languages: Markdown JavaScript


text:
<file_sep>import React, { Component } from 'react'

class BoardCreate extends Component {

  render() {
    return
Create a Board

  }
}

export default BoardCreate
<file_sep>import React, { Component } from 'react'

class BoardList extends Component {

  render() {
    return
All Boards Shown Here

  }
}

export default BoardList
<file_sep>import React from 'react'
import { Router, Route, Switch } from 'react-router-dom';
import BoardList from './boards/BoardList'
import BoardShow from './boards/BoardShow'
import BoardCreate from './boards/BoardCreate'
import BoardEdit from './boards/BoardEdit'
import BoardDelete from './boards/BoardDelete'
import Header from './Header'
import history from '../history'

  const App = () => {
    return (

        <Router history={history}>

          <Switch>
            <Route path='/' exact component={BoardList} />
            <Route path='/boards/new' exact component={BoardCreate} />
            <Route path='/boards/:id' exact component={BoardShow} />
            <Route path='/boards/edit/:id' exact component={BoardEdit}/>
            <Route path='/boards/delete/:id' exact component={BoardDelete}/>
          </Switch>
        </Router>

      )
    }

export default App;
<file_sep>import React, { Component } from 'react'

class BoardDelete extends Component {

  render() {
    return
BoardDelete

  }
}

export default BoardDelete

repo_name: bwadlow/honeydo


text:
<file_sep>#NoEnv						; Recommended for performance and compatibility with future AutoHotkey releases.
							; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input				; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%	; Ensures a consistent starting directory.

; Doc:
; 	!: Alt
;	^: Ctrl
;	#: Windows key
;	+: Shift

; Easier Home/End buttons
#Left::send {Home}
#Right::send {End}
#+Left::send +{Home}
#+Right::send +{End}

; Make Alt just as useful as Ctrl
#c::send ^c
#v::send ^v
#x::send ^x
#z::send ^z
#+z::send ^+z
#s::send ^s
#a::send ^a
#t::send ^t
#+t::send ^+t
#w::send ^w

#+Up::send +^{Home}
#+Down::send +^{End}

; Ctrl is just too far, so let's use Alt instead
!Left::send ^{Left}
!Right::send ^{Right}
!+Left::send ^+{Left}
!+Right::send ^+{Right}

!Up::send ^{Up}
!Down::send ^{Down}

; Navigation between tabs (like chrome).
#+a::send +^{Tab}
#+d::send  ^{Tab}

; Test:
; 	Msgbox It's been 1 sec since you release the %A_ThisHotKey%.
; 	SetTimer Test, Off
; Return<file_sep># AutoHotkey

**Link:** https://www.autohotkey.com/

## Description
I find mac's keyboard alot easier to use, so I'm using an Autohotkey script to make my other keyboards feel as close as possible to mac's keyboard.

languages: AutoHotkey Markdown

repo_language: AutoHotkey

repo_name: TermanEmil/AutoHotkeys


text:
<file_sep>package com.crm.qa.pages;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.CacheLookup;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.Select;
import org.testng.Assert;

import com.crm.qa.base.TestBase;
import com.crm.qa.util.TestUtil;

public class ContactsPage extends TestBase {

	@FindBy(xpath = "//a[@class='item' and @href='/contacts']")
	@CacheLookup
	WebElement contactslabel;

	@FindBy(xpath = "//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/table/tbody/tr[1]/td[1]/div")
	@CacheLookup
	WebElement selectContacts;

	@FindBy(xpath="//button[contains(text(),'New')]")
	@CacheLookup
	WebElement newContact;

	@FindBy(name="first_name")
	@CacheLookup
	WebElement firstname;

	@FindBy(name="last_name")
	@CacheLookup
	WebElement lastname;

	@FindBy(name="middle_name")
	@CacheLookup
	WebElement middlename;

	@FindBy(xpath="//div[@name='company']//input[@aria-autocomplete='list']")
	@CacheLookup
	WebElement companyName;

	@FindBy(xpath="//div[@role='combobox' and @class='ui active visible fluid multiple search selection dropdown']//input[@aria-autocomplete='list']")
	@CacheLookup
	WebElement tags;

	@FindBy(xpath="//div[@class='selected item addition']")
	@CacheLookup
	WebElement clickAddtags;

	  @FindBy(
	  xpath="//span[@class='text']//parent::div[@aria-checked='false']//parent::div[@class='selected item' ]//parent::div[@aria-multiselectable='true']"
	  ) @CacheLookup
	  WebElement clicktags;

	@FindBy(name="value")
	@CacheLookup
	WebElement email;

	@FindBy(name="name")
	@CacheLookup
	WebElement personalEmail;

	@FindBy(xpath="//div[@class='ui field']//div[@name='category']")
	@CacheLookup
	WebElement category;

	@FindBy(name="status")
	@CacheLookup
	WebElement status;

	@FindBy(xpath="//textarea[@name='description']")
	@CacheLookup
	WebElement description;

	@FindBy(xpath="//input[@name='value' and @placeholder='LinkedIn profile link']")
	@CacheLookup
	WebElement channel_type;

	@FindBy(xpath="//span[contains(text(),Facebook)]//parent::div[@class='item']//parent::div[@class='visible menu transition']")
	@CacheLookup
	WebElement socialChannel;

	@FindBy(xpath="//i[@class='dropdown icon']//parent::div[@name='channel_type']")
	@CacheLookup
	WebElement socialChannelclick;

	@FindBy(xpath="//div[@name='timezone']")
	@CacheLookup
	WebElement timeZone;

	@FindBy(xpath="//span[contains(text(),'Asia/Kolkata')]")
	@CacheLookup
	WebElement timeZoneclick;

	@FindBy(xpath ="//div[@class='ui input']//input[@name='address' and @placeholder='Street Address']")
	@CacheLookup
	WebElement address;

	@FindBy(xpath ="//div[@class='ui input']//input[@name='city' and @placeholder='City']")
	@CacheLookup
	WebElement cities;

	@FindBy(xpath ="//div[@class='ui input']//input[@name='state' and @placeholder='State / County']")
	@CacheLookup
	WebElement states;

	@FindBy(xpath ="//div[@class='ui input']//input[@name='zip' and @placeholder='Zip Code']")
	@CacheLookup
	WebElement zips;

	@FindBy(xpath ="//i[@class='dropdown icon']//parent::div[@name='country']")
	@CacheLookup
	WebElement selectcountries;

	@FindBy(xpath ="//span[@class='text' and text()='India']")
	@CacheLookup
	WebElement countries;

	@FindBy(xpath="//i[@class='dropdown icon']//parent::div[@name='hint']")
	@CacheLookup
	WebElement phonecountry;

	@FindBy(xpath="//span[@class='text' and text()='India']//parent::div[@class='item']")
	@CacheLookup
	WebElement selectphonecountry;

	@FindBy(xpath="//input[@name='value' and @placeholder='Number']")
	@CacheLookup
	WebElement phonenumbers;

	@FindBy(xpath="//input[@name='name' and @placeholder='Home, Work, Mobile...']")
	@CacheLookup
	WebElement homenumbers;

	@FindBy(xpath="//input[@name='position']")
	@CacheLookup
	WebElement positions;

	@FindBy(name="department")
	@CacheLookup
	WebElement departments;

	@FindBy(xpath="//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/form/div[11]/div[2]/div/div/input")
	@CacheLookup
	WebElement supervisor;

	@FindBy(xpath="//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/form/div[12]/div[1]/div/div/input")
	@CacheLookup
	WebElement assistant;

	@FindBy(xpath="//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/form/div[12]/div[2]/div/div/input")
	@CacheLookup
	WebElement referredBy;

	@FindBy(xpath="//div[@name='source']")
	@CacheLookup
	WebElement sources;

	@FindBy(xpath="//span[@class='text' and contains(text(),'Repeat Customer')]")
	@CacheLookup
	WebElement sourcesclick;

	@FindBy(xpath="//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/form/div[13]/div[2]/div/div/label")
	@CacheLookup
	WebElement donotcall;

	@FindBy(xpath="//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/form/div[14]/div[1]/div/div/label")
	@CacheLookup
	WebElement donotText;

	@FindBy(xpath="//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]/form/div[14]/div[2]/div/div/label")
	@CacheLookup
	WebElement dontemail;

	@FindBy(xpath="//input[@name='day']")
	@CacheLookup
	WebElement days;

	@FindBy(xpath="//div[@name='month']")
	@CacheLookup
	WebElement months;

	@FindBy(xpath="//span[@class='text' and text()='April']")
	@CacheLookup
	WebElement monthselect;

	@FindBy(xpath="//input[@name='year' and @placeholder='Year']")
	@CacheLookup
	WebElement years;

	@FindBy(xpath="//input[@name='identifier']")
	@CacheLookup
	WebElement identifiers;

	@FindBy(name="image")
	@CacheLookup
	WebElement image;

	@FindBy(xpath="//i[@aria-hidden='true' and @class='save icon']//parent::button[contains(text(),'Save')]")
	@CacheLookup
	WebElement saveButton;

	@FindBy(xpath="//span[@class='text' and contains(text(),'On Hold')]//parent::div[@role='option' and @aria-checked='false']")
	@CacheLookup
	WebElement onHold;

	@FindBy(xpath = "//span[@class='text' and contains(text(),'Affiliate')]")
	@CacheLookup
	WebElement affiliate;

	@FindBy(xpath = "//i[@aria-hidden='true' and @class='search icon']//parent::div[@role='combobox']//parent::label[@for='tags']")
	@CacheLookup
	WebElement search;

	@FindBy(xpath = "//p[contains(text(),'bhau')]")
	@CacheLookup
	WebElement getNameAfterSave;

	@FindBy(xpath = "//input[@name='image']")
	@CacheLookup
	WebElement fileNames;

	public ContactsPage() {
		PageFactory.initElements(driver, this);
	}

	public boolean verifyContactsLabel() {
		return contactslabel.isDisplayed();
	}

	public void clickOnContactsCheckBox(int tr) {
		driver.findElement(By.xpath("//*[@id=\"ui\"]/div/div[2]/div[2]/div/div[2]"
				+ "/table/tbody/tr["+tr+"]/td[1]/div")).click();
	}

	public void clickOnNewContact() {
		newContact.click();
	}

	public void saveNewContact(String firstName,String middleName,String lastName,String company,
		String emailAddress,String personalemailAdd,String tag,
				String descriptions,String channelname,String addrss,String city,String state,String zipss,
				String phonenumber,String homenumber,String position, String department,String dayss,String yearss
				,String identifier) throws Exception {

		  double phoneNumber = Double.parseDouble(phonenumber);
		  double homeNumber = Double.parseDouble(homenumber);
		  double day = Double.parseDouble(dayss);
		  double year = Double.parseDouble(yearss);
		  double zip = Double.parseDouble(zipss);

		  int phonedata=(int)phoneNumber;
		  int homedata=(int)phoneNumber;
		  int daydata=(int)day;
		  int yeardata=(int)year;
		  int zipdata=(int)zip;

		firstname.sendKeys(firstName);
		middlename.sendKeys(middleName);
		lastname.sendKeys(lastName);
		companyName.sendKeys(company);
		email.sendKeys(emailAddress);
		personalEmail.sendKeys(personalemailAdd);
		search.click();
		tags.sendKeys(tag);
		clickAddtags.click();
		search.click();
		category.click();
		affiliate.click();
		status.click();
		onHold.click();
		donotcall.click();
		donotText.click();
		dontemail.click();
		description.sendKeys(descriptions);
		socialChannelclick.click();
		socialChannel.click();
		channel_type.sendKeys(channelname);
		timeZone.click();
		timeZoneclick.click();
		address.sendKeys(addrss);
		cities.sendKeys(city);
		states.sendKeys(state);
		zips.sendKeys(String.valueOf(zipdata));
		selectcountries.click();
		countries.click();
		phonecountry.click();
		selectphonecountry.click();
		phonenumbers.sendKeys(String.valueOf(phonedata));
		homenumbers.sendKeys(String.valueOf(homedata));
		positions.sendKeys(position);
		departments.sendKeys(department);
		sources.click();
		sourcesclick.click();
		days.sendKeys(String.valueOf(daydata));
		months.click();
		monthselect.click();
		years.sendKeys(String.valueOf(yeardata));
		identifiers.sendKeys(identifier);

		//TestUtil.fileUpload(fileNames);
		saveButton.click();
		Thread.sleep(5000);

	}

	public void checkPerson(String middleName) {
		Assert.assertTrue(true);
	}

}
<file_sep>url =

username = <EMAIL>
password = <PASSWORD>

browser=Chrome<file_sep>package com.crm.qa.testcase;

import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import com.crm.qa.base.TestBase;
import com.crm.qa.pages.ContactsPage;
import com.crm.qa.pages.HomePage;
import com.crm.qa.pages.LoginPage;

public class HomePageTest extends TestBase {
	LoginPage loginPage;
	HomePage homePage;
	public HomePageTest() {
		super();
	}

	//TestCases Should be Separated-independent with each other
	//before each testcase launch browser and login
	//@test case run
	//after each test case --close the browser

	@BeforeMethod
	public void setUp() {
		initialization();
		loginPage=new LoginPage();
		homePage=loginPage.login(prop.getProperty("username"), prop.getProperty("password"));
	}

	@Test(priority = 1)
	public void verifyHomeTitleTest() {
		String homepagetitle = homePage.verifyHomePageTitle();
		Assert.assertEquals(homepagetitle, "Cogmento CRM","Home Page Title Not Match");
	}

	@Test(priority = 2)
	public void verifyUserNameTest() {
		boolean correctuserName = homePage.verifyCorrectuserName();
		Assert.assertTrue(correctuserName);
	}

	@Test(priority = 3)
	public void verifyContactLLinkTest() {
		homePage.clickOnContactsLink();
	}
	@AfterMethod
	public void tearDown()
	{
		driver.quit();
	}

}
<file_sep>package com.crm.qa.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

import org.apache.commons.io.FileUtils;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;

import com.crm.qa.base.TestBase;

public class TestUtil extends TestBase {
	public static long PAGE_LOAD_TIMEOUT = 80;
	public static long IMPLICIT_WAIT = 60;
	public static String TESTDATA_SHEET_PATH = "C:\\Users\\Admin\\git\\FreeCRMTest\\FreeCRMTest\\src"
			+ "\\main\\java\\com\\crm\\qa\\testdata\\signup.xlsx";
	public static Workbook book;
	public static Sheet sheet;

	public static Object[][] getTestData(String sheetName) {
		FileInputStream file = null;
		try {
			file = new FileInputStream(TESTDATA_SHEET_PATH);
		} catch (Exception e) {
			e.printStackTrace();
		}
		try {
			book = WorkbookFactory.create(file);
		} catch (Exception e) {
			e.printStackTrace();
		}
		sheet = book.getSheet(sheetName);
		Object[][] data = new Object[sheet.getLastRowNum()][sheet.getRow(0).getLastCellNum()];
		for (int i = 0; i < sheet.getLastRowNum(); i++) {
			for (int k = 0; k < sheet.getRow(0).getLastCellNum(); k++) {
				data[i][k] = sheet.getRow(i + 1).getCell(k).toString();
			}
		}
		return data;
	}

	public static void takeScreenshotAtEndOfTest() throws IOException {
		File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
		String currentDir = System.getProperty("user.dir");
		FileUtils.copyFile(scrFile, new File(currentDir + "/screenshots/" + System.currentTimeMillis() + ".png"));
	}

	/*
	 * public static void fileUpload(WebElement fileName) throws Exception {
	 * JavascriptExecutor js = (JavascriptExecutor) driver;
	 * js.executeScript("arguments[0].click();", fileName); String imageFilePath =
	 * "C:\\Users\\Admin\\Pictures\\SikuliTesting\\"; String inputFilePath =
	 * "C:\\Users\\Admin\\Pictures\\SikuliTesting\\";
	 *
	 * Screen screen = new Screen(); Pattern fileInputTextBox = new
	 * Pattern(imageFilePath + "FileTextBox.PNG"); Pattern openButton = new
	 * Pattern(imageFilePath + "open.png");
	 *
	 * screen.wait(fileInputTextBox,20); screen.type(fileInputTextBox, inputFilePath
	 * + "Artist.jpg"); screen.click(openButton); }
	 */

}

languages: Java INI

repo_language: Java


text:
<file_sep>#! /bin/bash

text="<PASSWORD>s_wort"

echo "$text	 # \$text, der komplette Text"
echo
echo "01234567890123"
echo "|   |"
echo $text
echo "${text:0:5}		 # \${text:0:5}, die ersten fuenf Zeichen von \"$text\"."
echo
echo "01234567890123"
echo "       |"
echo $text
echo "${text:7}		 # \${text:7}, alles ab den achten Zeichen."
echo
echo "01234567890123"
echo "       ||"
echo $text
echo "${text:7:2}		 # \${text:7:2}, mit dem achten Zeichen beginnend genau zwei Zeichen herausgreifen."

repo_language: Shell

repo_name: BerndStorck/Anleitungen


text:
<file_sep>import styled from 'styled-components';

export const Username = styled.div`
  flex-direction: column;
  justify-content: center;
  margin-left: 10px;

  span {
    font-size: 14px;
    color: #999;
    width: 170px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
`;

export const Actions = styled.div`
  display: flex;
  align-items: center;
  cursor: pointer;

  button {
    background: #f56c6c;
    border-radius: 50%;
    border: 0;
    font-size: 12px;
    height: 20px;
    margin-right: 15px;
    width: 20px;

    i {
      color: #fff !important;
    }

    &:hover {
      background: #ff3737;
    }
  }

  a {
    color: #999;
    font-size: 12px;

    &:hover {
      color: #000;
    }
  }
`;
<file_sep>import { all, takeLatest } from 'redux-saga/effects';

import { Types as DevelopersTypes } from '../ducks/developers';

import { addDevelopers, removeDevelopers } from './developers';

export default function* rootSaga() {
  yield all([takeLatest(DevelopersTypes.ADD_REQUEST, addDevelopers)]);
  yield all([takeLatest(DevelopersTypes.REMOVE_REQUEST, removeDevelopers)]);
}
<file_sep>import React from 'react';
import PropTypes from 'prop-types';

import { Username, Actions } from './styles';

const Item = ({ developer, onRemoveDeveloper }) => (

    <Username>
      {developer.login}
      {developer.node}
    </Username>
    <Actions>
      <button type="button" onClick={() => onRemoveDeveloper(developer.id)}>

      </button>

    </Actions>

);

Item.propTypes = {
  onRemoveDeveloper: PropTypes.func.isRequired,
  developer: PropTypes.shape({
    id: PropTypes.number.isRequired,
    login: PropTypes.string.isRequired,
    url: PropTypes.string.isRequired,
    avatar: PropTypes.string.isRequired,
    node: PropTypes.string.isRequired,
  }).isRequired,
};

export default Item;
<file_sep>import React from 'react';
import PropTypes from 'prop-types';

import { Container, Form, Feedback } from './styles';

const ModalDeveloper = ({
  show,
  onSubmited,
  onChanged,
  feedback,
  loading,
  handleDisplayModal,
  developerInput,
}) => (

    {show && (
      <Container>
        <Form onSubmit={onSubmited} feedbackType={feedback.type}>

Adicionar novo usuário

          <input
            type="text"
            placeholder="Usuário no Github"
            value={developerInput}
            onChange={e => onChanged(e)}
          />

            <button type="button" onClick={handleDisplayModal}>
              Cancelar
            </button>
            <button type="submit">
              {loading ?  : 'Salvar'}
            </button>

          {!!feedback.message && (
            <Feedback feedbackType={feedback.type}>{feedback.message}</Feedback>
          )}
        </Form>
      </Container>
    )}

);

ModalDeveloper.propTypes = {
  show: PropTypes.bool.isRequired,
  handleDisplayModal: PropTypes.func.isRequired,
  feedback: PropTypes.shape({
    type: PropTypes.string.isRequired,
    message: PropTypes.string.isRequired,
  }).isRequired,
  loading: PropTypes.oneOfType([PropTypes.bool]).isRequired,
  developerInput: PropTypes.oneOfType([PropTypes.string]).isRequired,
  onChanged: PropTypes.func.isRequired,
  onSubmited: PropTypes.func.isRequired,
};

export default ModalDeveloper;
<file_sep>export const Types = {
  ADD_REQUEST: 'developers/ADD_REQUEST',
  ADD_SUCCESS: 'developers/ADD_SUCCESS',
  ADD_FAILURE: 'developers/ADD_FAILURE',
  REMOVE_REQUEST: 'developers/REMOVE_REQUEST',
  REMOVE_SUCCESS: 'developers/REMOVE_SUCCESS',
  REMOVE_FAILURE: 'developers/REMOVE_FAILURE',
  RESET_FEEDBACK: 'developers/RESET_FEEDBACK',
};

const INITIAL_STATE = {
  loading: false,
  feedback: {
    type: '',
    message: '',
  },
  data: [],
};

export default function developers(state = INITIAL_STATE, action) {
  switch (action.type) {
    case Types.ADD_REQUEST:
      return { ...state, loading: true, feedback: INITIAL_STATE.feedback };
    case Types.ADD_SUCCESS:
      return {
        ...state,
        loading: false,
        feedback: { type: action.payload.type, message: action.payload.message },
        data: [...state.data, action.payload.data],
      };
    case Types.ADD_FAILURE:
      return {
        ...state,
        loading: false,
        feedback: { type: action.payload.type, message: action.payload.message },
      };
    case Types.REMOVE_REQUEST:
      return { ...state, loading: true, feedback: INITIAL_STATE.feedback };
    case Types.REMOVE_SUCCESS:
      return {
        ...state,
        loading: false,
        feedback: { type: action.payload.type, message: action.payload.message },
        data: [...action.payload.data],
      };
    case Types.REMOVE_FAILURE:
      return {
        ...state,
        loading: false,
        feedback: { type: action.payload.type, message: action.payload.message },
      };
    case Types.RESET_FEEDBACK:
      return {
        ...state,
        loading: false,
        feedback: INITIAL_STATE.feedback,
      };
    default:
      return state;
  }
}

export const Creators = {
  addDevelopersRequest: developer => ({
    type: Types.ADD_REQUEST,
    payload: { developer },
  }),
  addDevelopersSuccess: data => ({
    type: Types.ADD_SUCCESS,
    payload: data,
  }),
  addDevelopersFailure: message => ({
    type: Types.ADD_FAILURE,
    payload: message,
  }),
  removeDevelopersRequest: id => ({
    type: Types.REMOVE_REQUEST,
    payload: id,
  }),
  removeDevelopersSuccess: data => ({
    type: Types.REMOVE_SUCCESS,
    payload: data,
  }),
  removeDevelopersFailure: message => ({
    type: Types.REMOVE_FAILURE,
    payload: message,
  }),
  resetFeedback: () => ({
    type: Types.RESET_FEEDBACK,
    payload: {},
  }),
};
<file_sep>import React, { Component, Fragment } from 'react';
import ReactMapGL from 'react-map-gl';
import PropTypes from 'prop-types';

import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import mapBox from '../../services/mapbox';

import { Creators as DevelopersActions } from '../../store/ducks/developers';

import ModalDeveloper from '../Developers/Modal';
import CustomMarker from './Marker';

class Map extends Component {
  state = {
    viewport: {
      width: window.innerWidth,
      height: window.innerHeight,
      latitude: -3.806182,
      longitude: -38.5912083,
      zoom: 14,
    },
    visibleModal: false,
    developer: {
      input: '',
      latitude: 0,
      longitude: 0,
    },
  };

  componentDidMount() {
    window.addEventListener('resize', this.resize);

    this.resize();
  }

  componentWillUnmount() {
    window.removeEventListener('resize', this.resize);
  }

  resize = () => {
    const { viewport } = this.state;

    this.setState({
      viewport: {
        ...viewport,
        width: window.innerWidth,
        height: window.innerHeight,
      },
    });
  };

  openModalDeveloper = (e) => {
    const { developer } = this.state;

    const [longitude, latitude] = e.lngLat;

    this.setState({ developer: { ...developer, latitude, longitude } });

    this.handleDisplayModal();
  };

  handleDisplayModal = () => {
    const { resetFeedback } = this.props;
    const { developer, visibleModal } = this.state;

    this.setState({
      developer: { ...developer, input: '' },
      visibleModal: !visibleModal,
    });

    resetFeedback();
  };

  onStoreDeveloper = (e) => {
    e.preventDefault();

    const { developer } = this.state;

    const { addDevelopersRequest } = this.props;

    addDevelopersRequest(developer);

    this.setState({
      developer: {
        input: '',
        latitude: 0,
        longitude: 0,
      },
    });
  };

  handleMapClick = (e) => {
    console.log(e);
  };

  render() {
    const { developers } = this.props;
    const { viewport, visibleModal, developer } = this.state;

    return (
      <Fragment>
        <ReactMapGL
          onClick={this.openModalDeveloper}
          mapboxApiAccessToken={mapBox.token}
          mapStyle="mapbox://styles/mapbox/basic-v9"
          onViewportChange={data => this.setState({ viewport: data })}
          {...viewport}
        >
          {developers.data.map(item => (
            <CustomMarker developer={item} key={item.id} />
          ))}
        </ReactMapGL>
        <ModalDeveloper
          show={visibleModal}
          onSubmited={this.onStoreDeveloper}
          loading={developers.loading}
          feedback={developers.feedback}
          developerInput={developer.input}
          handleDisplayModal={this.handleDisplayModal}
          onChanged={e => this.setState({ developer: { ...developer, input: e.target.value } })}
        />
      </Fragment>
    );
  }
}

Map.propTypes = {
  resetFeedback: PropTypes.func.isRequired,
  addDevelopersRequest: PropTypes.func.isRequired,
  developers: PropTypes.shape({
    feedback: PropTypes.shape({
      type: PropTypes.string.isRequired,
      message: PropTypes.string.isRequired,
    }).isRequired,
    loading: PropTypes.oneOfType([PropTypes.bool]),
    data: PropTypes.arrayOf(
      PropTypes.shape({
        id: PropTypes.number.isRequired,
        login: PropTypes.string.isRequired,
        avatar: PropTypes.string.isRequired,
        url: PropTypes.string.isRequired,
        node: PropTypes.string.isRequired,
      }).isRequired,
    ),
  }).isRequired,
};

const mapStateToProps = state => ({
  developers: state.developers,
});

const mapDispatchToProps = dispatch => bindActionCreators(DevelopersActions, dispatch);

export default connect(
  mapStateToProps,
  mapDispatchToProps,
)(Map);
<file_sep>import { call, put, select } from 'redux-saga/effects';
import api from '../../services/api';

import { Creators as DevelopersCreators } from '../ducks/developers';

function* fetchDevelopers(developer) {
  const { data } = yield call(api.get, `/users/${developer.input}`);

  const developerData = {
    id: data.id,
    login: data.login,
    avatar: data.avatar_url,
    node: data.node_id,
    url: data.html_url,
    latitude: developer.latitude,
    longitude: developer.longitude,
  };

  return developerData;
}

function* checkIfDeveloperAdded({ input }) {
  const { developers } = yield select();

  const developer = developers.data.filter(item => item.login === input);

  return developer.length > 0;
}

export function* addDevelopers(action) {
  try {
    const data = yield fetchDevelopers(action.payload.developer);

    const developerIsAdded = yield checkIfDeveloperAdded(action.payload.developer);

    if (developerIsAdded) {
      yield put(
        DevelopersCreators.addDevelopersFailure({
          type: 'FAILURE',
          message: 'O usuário informado já foi adicionado aos favoritos!',
        }),
      );
      return;
    }

    const message = 'Usuário adicionado com sucesso aos favoritos!';

    yield put(DevelopersCreators.addDevelopersSuccess({ data, message, type: 'SUCCESS' }));
  } catch (err) {
    yield put(
      DevelopersCreators.addDevelopersFailure({
        type: 'FAILURE',
        message: 'O usuário informado não foi encontrado!',
      }),
    );
  }
}

export function* removeDevelopers(action) {
  try {
    const { developers } = yield select();

    const data = developers.data.filter(item => item.id !== action.payload.id);

    const message = 'Usuário removido dos favoritos com sucesso!';

    yield put(DevelopersCreators.removeDevelopersSuccess({ data, message, type: 'SUCCESS' }));
  } catch (err) {
    yield put(
      DevelopersCreators.removeDevelopersFailure({
        type: 'FAILURE',
        message: 'O usuário informado não foi encontrado!',
      }),
    );
  }
}


text:
<repo_name>LotusBro98/LikeBot<file_sep>/LikeBot.ino
#include <TroykaLedMatrix.h>
#include <Wire.h>
#include <ArduinoJson.h>
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <ESP8266HTTPClient.h>
#include <WiFiClientSecureBearSSL.h>

//String user = "alexpan98";
String user = "marg22";

//long user_id = 78646967; //"https://api.vk.com/method/users.get?user_ids=alexpan98&version=5.92&access_token=7<PASSWORD>5702315c3<PASSWORD>7<PASSWORD>f42c3<PASSWORD>4c16a6545<PASSWORD>"

const uint8_t fingerprint[20] = {0x6B, 0xE7, 0x68, 0x25, 0x31, 0xE1, 0x1C, 0x7A, 0x78, 0x24, 0xAD, 0xD3, 0x1D, 0x2C, 0xAE, 0x8C, 0xBF, 0x4A, 0x8F, 0x29};
const String access_token = "704a01f4704a01f4704a01f4d5702315c37704a704a01f42c37920924c16a65450ff6ce";
const String ver = "5.92";

long user_id;

const long MAX_POSTS = 4;
long posts_count;
long post_ids[MAX_POSTS];
long likesForPost[MAX_POSTS] = {};

const int JSON_BUF_SIZE = 4096;

enum check_status {
  CONN_FAILED,
  NEW_LIKE,
  NOTHING
};

const int FRAME_TIME = 300;
const uint8_t heart[][8] {
  {
    0b00000000,
    0b00000000,
    0b00000000,
    0b00000000,
    0b00011000,
    0b00000000,
    0b00000000,
    0b00000000,
  },
  {
    0b00000000,
    0b00000000,
    0b00000000,
    0b00111100,
    0b00111100,
    0b00011000,
    0b00000000,
    0b00000000,
  },
  {
    0b00000000,
    0b00000000,
    0b01100110,
    0b01111110,
    0b01111110,
    0b00111100,
    0b00011000,
    0b00000000,
  },
  {
    0b00000000,
    0b01100110,
    0b11111111,
    0b11111111,
    0b11111111,
    0b01111110,
    0b00111100,
    0b00011000,
  },
  {
    0b00000000,
    0b01100110,
    0b11111111,
    0b11111111,
    0b11111111,
    0b01111110,
    0b00111100,
    0b00011000,
  },
  {
    0b01100110,
    0b11111111,
    0b11111111,
    0b11111111,
    0b11111111,
    0b11111111,
    0b01111110,
    0b00111100,
  },
  {
    0b00000000,
    0b01100110,
    0b11111111,
    0b11111111,
    0b11111111,
    0b01111110,
    0b00111100,
    0b00011000,
  },
  {
    0b00000000,
    0b01100110,
    0b11111111,
    0b11111111,
    0b11111111,
    0b01111110,
    0b00111100,
    0b00011000,
  },
  {
    0b01100110,
    0b11111111,
    0b11111111,
    0b11111111,
    0b11111111,
    0b11111111,
    0b01111110,
    0b00111100,
  },
  {
    0b00000000,
    0b01100110,
    0b11111111,
    0b11111111,
    0b11111111,
    0b01111110,
    0b00111100,
    0b00011000,
  },
  {
    0b00000000,
    0b01100110,
    0b11111111,
    0b11111111,
    0b11111111,
    0b01111110,
    0b00111100,
    0b00011000,
  },
  {
    0b01100110,
    0b11111111,
    0b11111111,
    0b11100111,
    0b11100111,
    0b11111111,
    0b01111110,
    0b00111100,
  },
  {
    0b11111111,
    0b11111111,
    0b11100111,
    0b11000011,
    0b11000011,
    0b11100111,
    0b11111111,
    0b01111110,
  },
  {
    0b11111111,
    0b11100111,
    0b11000011,
    0b10000001,
    0b10000001,
    0b11000011,
    0b11100111,
    0b11111111,
  },
  {
    0b11000011,
    0b10000001,
    0b00000000,
    0b00000000,
    0b00000000,
    0b00000000,
    0b10000001,
    0b11000011,
  },
  {
    0b00000000,
    0b00000000,
    0b00000000,
    0b00000000,
    0b00000000,
    0b00000000,
    0b00000000,
    0b00000000,
  },
};

const uint8_t disconnected[][8] {
  {
    0b00000000,
    0b00000000,
    0b00000000,
    0b00000000,
    0b00000000,
    0b01000000,
    0b01100000,
    0b00000000
  },
  {
    0b00000000,
    0b00000000,
    0b00000000,
    0b01100000,
    0b00010000,
    0b01001000,
    0b01101000,
    0b00000000
  },
  {
    0b00000000,
    0b01110000,
    0b00001000,
    0b01100100,
    0b00010010,
    0b01001010,
    0b01101010,
    0b00000000
  },
  {
    0b00000000,
    0b01110000,
    0b00001000,
    0b01100100,
    0b00010010,
    0b00001010,
    0b00001010,
    0b00000000
  },
  {
    0b00000000,
    0b01110000,
    0b00001000,
    0b00000100,
    0b00000010,
    0b00000010,
    0b00000010,
    0b00000000
  },
  {
    0b00000000,
    0b00000000,
    0b00000000,
    0b00000000,
    0b00000000,
    0b00000000,
    0b00000000,
    0b00000000,
  }
};

ESP8266WiFiMulti WiFiMulti;

TroykaLedMatrix matrix;

StaticJsonDocument<JSON_BUF_SIZE> doc;

int askJson(StaticJsonDocument<JSON_BUF_SIZE>& doc, HTTPClient& https, std::unique_ptr<BearSSL::WiFiClientSecure> &client, String& url)
{
  if (https.begin(*client, url)) {
    int httpCode = https.GET();
    if (httpCode > 0) {
      //Serial.printf("[HTTPS] GET... code: %d\n", httpCode);

      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {
        //String payload = https.getString();
        //Serial.println(payload.length());
        //Serial.println(payload);

        deserializeJson(doc, *client);
        //deserializeJson(doc, payload);
      }
    } else {
      Serial.printf("[HTTPS] GET... failed, error: %s\n", https.errorToString(httpCode).c_str());
      return false;
    }
    https.end();
  } else {
    Serial.printf("[HTTPS] Unable to connect\n");
    return false;
  }

  return true;
}

int lookUpUser()
{
  if ((WiFiMulti.run() != WL_CONNECTED))
    return CONN_FAILED;

  std::unique_ptr<BearSSL::WiFiClientSecure>client(new BearSSL::WiFiClientSecure);
  client->setFingerprint(fingerprint);

  HTTPClient https;

  if (!askJson(doc, https, client,
    String("https://api.vk.com/method/users.get?")+
    "user_ids=" + user +
    "&version=" + ver +
    "&access_token=" + access_token
  )) return false;

  user_id = doc["response"][0]["uid"];
  Serial.println(user_id);
  return true;
}

int lookUpPostIds()
{
  if ((WiFiMulti.run() != WL_CONNECTED))
    return CONN_FAILED;

  std::unique_ptr<BearSSL::WiFiClientSecure>client(new BearSSL::WiFiClientSecure);
  client->setFingerprint(fingerprint);

  HTTPClient https;

  if (!askJson(doc, https, client,
    String("https://api.vk.com/method/wall.get?")+
    "owner_id=" + user_id +
    "&version=" + ver +
    "&count=" + 1 +
    "&access_token=" + access_token
  )) return false;

  posts_count = doc["response"][0];
  if (posts_count > MAX_POSTS)
  posts_count = MAX_POSTS;

  for (long i = 0; i < posts_count; i++)
  {
    if (!askJson(doc, https, client,
      String("https://api.vk.com/method/wall.get?")+
      "owner_id=" + user_id +
      "&version=" + ver +
      "&count=" + 1 +
      "&offset=" + i +
      "&access_token=" + access_token
    )) return false;

    long id = doc["response"][1]["id"];
    Serial.println(id);

    post_ids[i] = id;
  }
  return true;
}

int checkLikes()
{
  if ((WiFiMulti.run() != WL_CONNECTED))
    return CONN_FAILED;

  std::unique_ptr<BearSSL::WiFiClientSecure>client(new BearSSL::WiFiClientSecure);
  client->setFingerprint(fingerprint);

  HTTPClient https;

  bool liked = false;

  for (long i = 0; i < posts_count; i++)
  {
    long id = post_ids[i];

    if (!askJson(doc, https, client,
      String("https://api.vk.com/method/likes.getList?")+
      "owner_id=" + user_id +
      "&type=post" +
      "&item_id=" + id +
      "&version=" + ver +
      "&access_token=" + access_token
    )) return CONN_FAILED;

    long likes = doc["response"]["count"];
    Serial.println(likes);

    if (likes != likesForPost[i])
      liked = true;

    likesForPost[i] = likes;
  }

  if (liked)
    return NEW_LIKE;
  else
    return NOTHING;
}

uint8_t get_bit(uint8_t line, int i)
{
  return (line >> i) & 1;
}

void set_bit(uint8_t &line, int i, uint8_t b)
{
  if (b == 0)
    line &= ~(1 << i);
   else
    line |= 1 << i;
}

void playHeartAnimation()
{
  int FRAMES = sizeof(heart) / 8;
  for (int i = 0; i < FRAMES; i++)
  {
    uint8_t buf[8];
    for (int j = 0; j < 8; j++)
     for (int k = 0; k < 8; k++)
      set_bit(buf[j], k, get_bit(heart[i][7 - k], j));

    matrix.drawBitmap(buf);
    //matrix.drawBitmap(heart[i]);
    delay(FRAME_TIME);
  }
}

void playDisconnectedAnimation()
{
  int FRAMES = sizeof(disconnected) / 8;
  for (int i = 0; i < FRAMES; i++)
  {
    uint8_t buf[8];
    for (int j = 0; j < 8; j++)
     for (int k = 0; k < 8; k++)
      set_bit(buf[j], k, get_bit(disconnected[i][7 - k], j));

    matrix.drawBitmap(buf);
    //matrix.drawBitmap(disconnected[i]);
    delay(FRAME_TIME);
  }
}

void setup() {

  Serial.begin(115200);
  // Serial.setDebugOutput(true);

  Serial.println();

  WiFi.mode(WIFI_STA);
  WiFiMulti.addAP("WAZZUPSQUADFAM", "88005553535");
  WiFiMulti.addAP("Voodoo Restoration", "");

  matrix.begin();
  matrix.clear();

  while(!lookUpUser())
  {
    playDisconnectedAnimation();
    Serial.println("Failed to connect");
  }

  while(!lookUpPostIds())
  {
    playDisconnectedAnimation();
    Serial.println("Failed to connect");
  }

}

void loop() {
  // wait for WiFi connection

  //int status = checkLikes();

  while (Serial.available() > 0)
  {
    char c = Serial.read();
    if (c == 'e')
      playHeartAnimation();
  }
  delay(100);

  switch (status)
  {
    case NEW_LIKE:
      Serial.println("New like!");
      playHeartAnimation();
      break;
    case CONN_FAILED:
      Serial.println("Failed to connect");
      playDisconnectedAnimation();
      break;
    default:
      matrix.clear();
      break;
  }

  delay(1000);
}


text:
<repo_name>buzzjmd/buzzjmd-leo-outlines<file_sep>/README.md
# buzzjmd-leo-outlines

repo_name: buzzjmd/buzzjmd-leo-outlines


text:
<repo_name>haraldreingruber/teamcity-vagrant<file_sep>/.gitattributes
# Auto detect text files and perform LF normalization
* text=auto

*.txt           text
*.sh            eol=lf

repo_language: Git Attributes

repo_name: haraldreingruber/teamcity-vagrant