String calculation effect in JavaScript

Month: November 2016

String calculation effect in JavaScript

In one of my posts I wrote about the Strong-Password Plugin. The secret of its attractiveness lays in usage of interesting effect: a new password is being calculated on the eyes of the visitor. Let’s discuss how to create such an effect. We need a function that will generate our effect of “string calculation”.¬† I named it generate. var generate = function(str, result, from, delay) { // Our code will be here…. } Our function takes four parameters, the first two are required. str – it’s a string that¬† will be shown at the end (the result of calculations) result

Continue Reading

Learn You Scala for Great Good! Part 3

In my previous posts Learn You Scala for Great Good! and Learn You Scala for Great Good! Part 2 I told how I started studying Haskell in order to get knowledge in functional programming in Scala. While I was reading Learn You a Haskell for Great Good! I started to “translate” some examples from Haskell into Scala. Today I shall take some interesting examples from the Recursion chapter of this book. replicate function The replicate function takes an Int and some element and returns a list that has several repetitions of the same element.   Haskell replicate :: (Num i,

Continue Reading

Strong Password Generator

Today I want to tell about the jQuery plugin which I wrote this March: strong-password.js If you need to give a hint for your new visitor of your site how to create a good password: memorable and strong, you can take an opportunity of using this simple plugin. And it’s available for download on GitHub under the MIT License. The plugin can be plugged to a form password field, and when a new visitor clicks on this field an animated popover will appear with a generated password. The password consists of a combination of vowels and consonants, so it is

Continue Reading

Learn You Scala for Great Good! Part 2

Last time I wrote about my experience in learning of functional programming basics using Learn You a Haskell for Great Good! with accent on Scala. Today I’m going to use an example from the Recursion chapter. Maximum awesome In Haskell example the maximum function takes a list of things that can be ordered (e.g. instances of the Ord typeclass) and returns the biggest of them. maximum :: (Ord a) => [a] -> a maximum [] = error “maximum of empty list” maximum [x] = x maximum (x:xs) | x > maxTail = x | otherwise = maxTail where maxTail =

Continue Reading

Learn You Scala for Great Good!

I came to Scala from Java. So when I wanted to learn Scalaz, I didn’t know what to start with. I decided that the best way would be to start with functional programming. It’s strange but the best manual was Learn You a Haskell for Great Good! Yes, I chose my way: I started learning Haskell in order to know Scala better! For better understanding I started to “translate” Haskell examples into Scala. Now I have decided to publish these examples. Guards, guards! We’re going to make a simple function that berates you differently depending on your BMI (body mass

Continue Reading