Skip to content

Instantly share code, notes, and snippets.

View VeronicaM's full-sized avatar
🦋
Focusing

Veronica Mihai VeronicaM

🦋
Focusing
View GitHub Profile
@VeronicaM
VeronicaM / speechRecognition.js
Last active May 4, 2019 20:06
Identified spoken words
startSpeechRecognition() {
try {
SpeechRecognitionService.activate();
SpeechRecognitionService.setNoMatchCallback((transcript) => {
this.handleFormInputSubmit(transcript);
});
SpeechRecognitionService.setUnrecognizedCallback((transcript) => {
console.log("I'm not sure, but I think you said, '" + transcript + "'");
window.alert('info ' + "I'm not sure, but I think you said, '" + transcript + "'");
});
@VeronicaM
VeronicaM / googleVisionTermsStructure.js
Created April 16, 2019 00:02
Google Vision Terms data structure
googleVisionTerms.data.forEach((word, index) => {
vocabularyResults.entities.push(Object.assign({}, word, {
saved: false,
strength: GOOGLE_VISION,
entityId: index,
image: `https://source.unsplash.com/collection/${index}/1600x900`,
courseLanguage: langCourse,
interfaceLanguage: langInterface,
courseKeyPhrase: { value: word.courseLang },
courseTranslation: { value: word.courseLang },
@VeronicaM
VeronicaM / speak,js
Created April 15, 2019 23:56
Utter word in course language with Web Speech API
const courseLang = CurrentUserService.getLangCourseCode();
const voice = SpeechSynthesisService.getVoices().find((voice) => voice.lang.indexOf(courseLang) > -1);
SpeechSynthesisService.speak(this.props.value, {
lang: courseLang,
voice: voice.name,
rate: 1.0,
pitch: 1.0,
volume: 1.0
});
@VeronicaM
VeronicaM / googleVisionRequest.js
Created April 15, 2019 23:39
send image to google vision endpoint
// Get an image dataURL from the canvas.
var imageDataURL = hidden_canvas.toDataURL('image/png');
var courseLang = document.querySelector('#courseLanguage').value;
return fetch(url, {
method: "POST",
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ img: imageDataURL, courseLang: courseLang })
}).then(response => response.json())
@VeronicaM
VeronicaM / wordSchema.js
Last active April 15, 2019 23:40
Word schema
'use strict';
var mongoose = require('mongoose');
var WordSchema = new mongoose.Schema({
text: String
});
WordSchema.virtual('id').get(function() {
return this._id;
['@babel/preset-env', {
modules: 'commonjs',
debug: false, // logs which plugins, polyfills are included
corejs: 2, // indicates where the polyfills are to be included from
/*
* analyses the sources codes and includes polyfills
* based on supported browsers in browserslist
* https://babeljs.io/docs/en/babel-preset-env#usebuiltins
*/
useBuiltIns: 'usage',
@VeronicaM
VeronicaM / .block
Created September 16, 2017 07:54
fresh block
license: mit
Uncaught TypeError: _validator_map[validator_parts[0]] is not a function
at https://a.slack-edge.com/2ce61/js/rollup-secondary_a_required.js:41:24063
at Array.every (native)
at _validate (https://a.slack-edge.com/2ce61/js/rollup-secondary_a_required.js:41:23865)
at HTMLInputElement.<anonymous> (https://a.slack-edge.com/2ce61/js/rollup-secondary_a_required.js:41:18124)
at https://a.slack-edge.com/2ce61/js/rollup-secondary_a_required.js:29:27493
rollup-secondary_a_required.js:41 Uncaught TypeError: _validator_map[validator_parts[0]] is not a function
• Always checkout master branch first with git checkout master
• Do a git pull origin master to bring in the latest changes
• Now create a new branch to work on a new feature with git branch your-branch-name
• Switch to your new branch with git checkout your-branch-name
• Start coding stuff
• Do git status to see what you will be committing to git
• Do git add -A to add everything or add only what you want to add with git add filename
• Do a commit with git commit -m "type message about your commit here"
• Push to the remote branch with git push origin your-branch-name
• Go over to the github repo page and do a pull request (PR) on your branch and wait for someone to check it out and merge your updates to master
@VeronicaM
VeronicaM / daily-css-images-portfolio.markdown
Created February 20, 2017 16:10
Daily CSS Images Portfolio

Daily CSS Images Portfolio

A portfolio template for the Daily CSS Images challenge, just update your name, insert your thoughts, and update the img src URLs | Need help? See our guide: https://medium.com/dailycssimages/daily-css-images-portfolio-template-6087907b5d07#.8y3mpbw7a

Not signed up? Sign up here: http://dailycssimages.com/

Daily CSS Images is a 100% free 50-day challenge where you will receive a pure CSS image challenge right to your inbox each weekday.

I am thankful for any feedback, cheers!