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 { Component, OnInit } from '@angular/core'; | |
@Component({ | |
selector: 'app-dependency-injection', | |
templateUrl: './dependency-injection.component.html', | |
styleUrls: ['./dependency-injection.component.scss'] | |
}) | |
export class DependencyInjectionComponent implements OnInit { | |
// Car |
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 { Injectable } from '@angular/core'; | |
import { BehaviorSubject } from 'rxjs'; | |
@Injectable() | |
export class DataService { | |
private messageSource = new BehaviorSubject('default message'); | |
currentMessage = this.messageSource.asObservable(); | |
constructor() { } |
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
let expressions = [10, 14]; | |
console.log(expressions); | |
let p1 = expressions[1]; | |
let a1 = expressions[0]; | |
let s1 = (p1 + (Math.sqrt(Math.pow(p1, 2) - 16 * a1 )))/4; | |
let s2 = (p1 - (Math.sqrt(Math.pow(p1, 2) - 16 * a1 )))/4; | |
let arr = []; |
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
// find repetitive charachters from string using javascript | |
var str = 'abcaefbhij'; | |
var count = 1; | |
var num = 0; | |
var temp = str.charAt(num); | |
// console.log(temp); | |
for (let i = 1; i <= str.length; i++) { | |
if (str.charAt(i)==temp) { |
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
def get_vendors | |
@vendors = Vendor.all.order(id: :asc) | |
@vendors_array = [] | |
@vendors.each do |vendor| | |
@vendors_array << vendor.name | |
end | |
end | |
def new |
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
// 1. Set up the reCAPTCHA verifier | |
// firebase.auth().languageCode = 'it'; | |
// To apply the default browser preference instead of explicitly setting it. | |
firebase.auth().useDeviceLanguage(); | |
// Use invisible reCAPTCHA | |
function captchaVerifier() { | |
window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('sign-in-button', { | |
'size': 'invisible', |
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
require 'open-uri' | |
module Api | |
module V1 | |
class AuthController < ApplicationController | |
# send code | |
def send_code | |
phone_number = params[:phone_number] | |
recaptcha_token = params[:recaptcha_token] | |
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"; | |
class Welcome extends React.Component { | |
render() { | |
return ( | |
<div> | |
Welcome {this.props.user} | |
</div> | |
); | |
} |
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, {Component} from 'react'; | |
export default function Hoc(HocComponent, data){ | |
return class extends Component{ | |
constructor(props) { | |
super(props); | |
this.state = { | |
data: data | |
}; | |
} |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
<style> |