Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Sajan Thomas sajanthomas01

🏠
Working from home
View GitHub Profile
View flutter_ui_test.dart
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 Nov 25, 2019
modified speech.js
View 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 Nov 25, 2019
Modified index.html
View 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"/>
View speech.js
$(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("");
View 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 / payment.js
Created Sep 7, 2018
Express backend main file
View payment.js
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 Sep 7, 2018
Webview where we load url
View WebView.js
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 Sep 7, 2018
Homescreen where the particulars are added
View HomeScreen.js
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 = {
View 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';