Skip to content

Instantly share code, notes, and snippets.

@dragulceo
Forked from 140bytes/LICENSE.txt
Last active December 30, 2015 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dragulceo/7852420 to your computer and use it in GitHub Desktop.
Save dragulceo/7852420 to your computer and use it in GitHub Desktop.

140byt.es

A tweet-sized, fork-to-play, community-curated collection of JavaScript.

How to play

  1. Click the Fork button above to fork this gist.
  2. Modify all the files to according to the rules below.
  3. Save your entry and tweet it up!

Keep in mind that thanks to the awesome sensibilities of the GitHub team, gists are just repos. So feel free to clone yours and work locally for a more comfortable environment, and to allow commit messages.

Rules

All entries must exist in an index.js file, whose contents are

  1. an assignable, valid Javascript expression that
  2. contains no more than 140 bytes, and
  3. does not leak to the global scope.

All entries must also be licensed under the WTFPL or equally permissive license.

For more information

See the 140byt.es site for a showcase of entries (built itself using 140-byte entries!), and follow @140bytes on Twitter.

To learn about byte-saving hacks for your own code, or to contribute what you've learned, head to the wiki.

140byt.es is brought to you by Jed Schmidt, with help from Alex Kloss. It was inspired by work from Thomas Fuchs and Dustin Diaz.

function(p,v,i,f){
p=speechSynthesis; // https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html#tts-section
v=p.getVoices(); // get all available voices
i=v.length; // loop length
while(i--){ // loop
f=new SpeechSynthesisUtterance("Go back to work"); //see here https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html#utterance-attributes
f.voice=v[i]; //set the voice
p.speak(f) //speak to me you soulless machine
}
};
function(p,v,i,f){p=speechSynthesis;v=p.getVoices();i=v.length;while(i--){f=new SpeechSynthesisUtterance("Go back to work");f.voice=v[i];p.speak(f)}};
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
{
"name": "iWontDoWhatYouTellMe",
"description": "It will remind you of something very important. Unfortunately at the time of writting this only works in chrome canary"
"keywords": [
"reminder",
"text to speech",
"speach",
"go back to work"
]
}
<!DOCTYPE html>
<title>Listen..</title>
<div>just listen to this</div>
<script type="text/javascript">
// write a small example that shows off the API for your example
// and tests it in one fell swoop.
var myFunction = function(p,v,i,f){console.log('a');p=speechSynthesis;v=p.getVoices();i=v.length;console.log(window.speechSynthesis);while(i--){f=new SpeechSynthesisUtterance("Go back to work");f.voice=v[i];p.speak(f);console.log(p);}};
if(!('speechSynthesis' in window ) || !('SpeechSynthesisUtterance' in window)) {
alert('You need chrome canary with experimental flags turned on or compatible browser (has speech to text)');
//return;
} else {
speechSynthesis.onvoiceschanged = function () {
myFunction();
};
}
</script>
@dragulceo
Copy link
Author

Here is a preview: preview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment