function cubologo(top, left, parent) {
var logo = document.createElement("div");
logo.classList.add("logo");
logo.style.top = top + "px";
logo.style.left = left + "px";
parent.appendChild(logo);
return logo;
}
function generateRandomWords(length) {
var result = '';
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}
generateRandomWords(15)
function typeText(words, bgcolor, textcolor, speed) {
let note = document.createElement('div')
document.body.appendChild(note)
note.style.background = bgcolor
note.style.color = textcolor
note.style.fontSize = '1.2rem'
note.style.margin = '1rem 0'
note.style.padding = '.5rem'
const letter = words.split('')
letter.forEach((letter, i) => {
setTimeout(() => note.textContent += letter, 70 * i)
})
if (speed) {
setTimeout(() => note.remove(), 70 * letter.length + speed)
} else {
setTimeout(() => note.remove(), 70 * letter.length + 350)
}
}
typeText('This is a message.', 'lightblue', 'white', 600)
def getRandomSounds(sounds)
return sounds[Math.floor(Math.random() * sounds.length)]
function move(id) {
var elem = document.getElementById(id);
var pos = -10;
var id = setInterval(frame, 5);
function frame() {
if (pos >= window.innerWidth) {
clearInterval(id);
} else {
pos++;
elem.style.left = pos + 'px';
}
}
}
d3.select("body").style("overflow", "hidden")
d3.select("body").style("width", "100%")
function typeText(words, bgcolor, textcolor, speed) {
let note = document.createElement('div')
document.body.appendChild(note)
}
function playSound() {
var sounds = [
new Audio('assets/melos/melo1.mp3'),
new Audio('assets/melos/melo2.mp3'),
new Audio('assets/melos/melo3.mp3'),
new Audio('assets/melos/melo4.mp3'),
new Audio('assets/melos/melo5.mp3'),
new Audio('assets/melos/melo6.mp3'),
];
sounds[Math.floor(Math.random() * sounds.length)].play();
}
import random
#this function takes a random word from a list and capitalize it
def random_words(words):
return random.choice(words).capitalize()
#this function makes a random lenght
def length(words):
return len(random_words(words))
#this function counts how many times the letter 'a' apears in the random word
def count_a(words):
sum = 0
for i in random_words(words):
if i == 'a':
sum = sum + 1
return sum
#this function makes a list of random words with random lenght
def random_list(words):
list = []
for i in range(10):
list.append(random_words(words))
return list
#this function counts how many times the letter 'a' apears in the random word
def count_a(words):
sum = 0
for i in random_words(words):
if i == 'a':
sum = sum + 1
return sum
#this
function cubologo(top, left, parent) {
var div = document.createElement('div');
div.className = 'logo';
div.style.top = top + 'px';
div.style.left = left + 'px';
parent.appendChild(div);
}
cubologo(0, 0, document.body)
$(function(){
$('.btn-primary').click(function(){
var $target = $('#i1'),
speed = 500;
$target.animate({
left: '-=30%'
}, speed);
$target.animate({
left: '+=30%'
}, speed);
});
});
function typeText(words, bgcolor, textcolor, speed) {
let note = document.createElement('div')
document.body.appendChild(note)
}
function cubologo(top, left, parent) {
var div = document.createElement('div');
div.style.backgroundColor = 'red';
div.style.width = '100px';
div.style.height = '100px';
div.style.position = 'absolute';
div.style.top = top;
div.style.left = left;
div.style.transform = 'rotateY(90deg)';
div.style.transition = 'transform .5s'
document.querySelector(parent).appendChild(div);
}
cubologo('300px', '300px', 'body');
function styles(x, y) {
return (
`.div {
color: red;
position: absolute;
left: ${x}px;
top: ${y}px;
animation: spin-rotate 1s linear infinite;
}
@keyframes spin-rotate {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
`
)
}
function randomWord() {
return Math.random().toString(36).substring(7);
}
randomWord()
function change() {
var b = document.getElementById("div1");
b.style.transform = "rotate(30deg)";
b.style.transitionDuration = "3s";
setTimeout(change2, 3000);
}
function change2() {
var b = document.getElementById("div1");
b.style.transform = "rotate(0deg)";
b.style.transitionDuration = "3s";
setTimeout(change, 3000);
}
import random
import string
def random_word(length):
word = ''
for i in range(length):
word += random.choice(string.ascii_letters)
return word