Skip to content

Instantly share code, notes, and snippets.

View sajanthomas01's full-sized avatar
🏠
Working from home

Sajan Thomas sajanthomas01

🏠
Working from home
View GitHub Profile
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:ui_learn/models/instructor.dart';
class ListPage extends StatefulWidget {
@override
_ListPageState createState() => _ListPageState();
}
class _ListPageState extends State<ListPage> {
@sajanthomas01
sajanthomas01 / speech.js
Created November 25, 2019 07:06
modified speech.js
$(function() {
// initialize select for materialize
$("select").formSelect();
function populateVoiceList() {
let voices = window.speechSynthesis.getVoices();
var voiceList = "";
for (i = 0; i < voices.length; i++) {
console.log(voices[i].name);
voiceList += `<option value="${i}">${voices[i].name} (${voices[i].lang})</option>`;
@sajanthomas01
sajanthomas01 / index.html
Created November 25, 2019 07:05
Modified index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>WebSpeech API</title>
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--Import materialize.css-->
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css" media="screen,projection"/>
@sajanthomas01
sajanthomas01 / speech.js
Created November 25, 2019 06:10
Webspeech API
$(function() {
// on click of button we read the text from input field
$(document).on("click", "#tts_button", function() {
let text = $("#tts_input")
.val()
.trim();
// just in the below 2 lines of code magic happens
const speak = new SpeechSynthesisUtterance(text);
speechSynthesis.speak(speak);
$("#tts_input").val("");
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>WebSpeech API</title>
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--Import materialize.css-->
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css" media="screen,projection"/>
@sajanthomas01
sajanthomas01 / payment.js
Created September 7, 2018 12:10
Express backend main file
var express = require('express');
var router = express.Router();
var request = require('request');
router.get('/', function (req, res) {
res.json({error:'error'})
});
router.post('/', function (req, res) {
@sajanthomas01
sajanthomas01 / WebView.js
Last active September 7, 2018 18:52
Webview where we load url
import React from 'react';
import { Text, WebView, ToastAndroid, Alert } from 'react-native';
import axios from 'axios';
export default class Webview extends React.Component {
constructor(props) {
super(props)
this.state = { url: null }
}
componentDidMount() {
const { state } = this.props.navigation;
@sajanthomas01
sajanthomas01 / HomeScreen.js
Last active September 7, 2018 18:55
Homescreen where the particulars are added
import React from 'react';
import { View, Text, TextInput, TouchableOpacity, Alert, ToastAndroid } from 'react-native';
import axios from 'axios';
import {IP} from '../constants'
export default class HomeScreen extends React.Component {
constructor(props) {
super(props)
this.state = {
@sajanthomas01
sajanthomas01 / App.js
Last active September 7, 2018 12:03
App.js
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React from 'react';
import { createStackNavigator } from 'react-navigation';
import HomeScreen from './src/HomeScreen';