String permutation
How do I make an string permutation?
Getting creative with string permutation. What is a string permutation? How do you make a string permutation? This script and codes were developed by John Urbank on 08 July 2022, Friday.
String permutation - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>String permutation</title> <script src="http://s.codepen.io/assets/libs/modernizr.js" type="text/javascript"></script> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ html, body, .wrap { height: 100%; margin: 0; padding: 0;
}
body { background: #252525; overflow: hidden; font-family: Helvetica;
}
input { background: #1a1a1a; border: 2px solid #2B2B2B; padding: 2%; color: #ccc; font-size: .9em; position: relative; margin: 4% 0 4% 4%; text-align: center; max-width: 90px; outline: none;
}
.bar { text-align: center; position: relative; top: 1%; float: left; padding-top: 3%; color: rgba(255, 255, 255, 0.4);
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <body> <input type="text" placeholder="enter a string" maxlength="4"> <div class="wrap"></div>
</body> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
String permutation - Script Codes CSS Codes
html, body, .wrap { height: 100%; margin: 0; padding: 0;
}
body { background: #252525; overflow: hidden; font-family: Helvetica;
}
input { background: #1a1a1a; border: 2px solid #2B2B2B; padding: 2%; color: #ccc; font-size: .9em; position: relative; margin: 4% 0 4% 4%; text-align: center; max-width: 90px; outline: none;
}
.bar { text-align: center; position: relative; top: 1%; float: left; padding-top: 3%; color: rgba(255, 255, 255, 0.4);
}
String permutation - Script Codes JS Codes
$(document).ready(function($) { var button = $('button'); $('input[type="text"]').keyup(function() { var input = $('input[type="text"]').val(), bar = $('.bar'); bar.remove(); //string permutation algorythm - credit goes to Skeeto: http://www.reddit.com/user/skeeto function permute(string) { function recur(string, prefix) { if (string.length === 0) { return [prefix]; } else { var out = []; for (var i = 0; i < string.length; i++) { var pre = string.substring(0, i); var post = string.substring(i + 1); out = out.concat(recur(pre + post, string[i] + prefix)); } return out; } } var distinct = {}; recur(string, "").forEach(function(result) { distinct[result] = true; }); //let's get creative var permutedString = Object.keys(distinct), a = permutedString.toString(), b = a.split(","), wrap = $('.wrap'); for(i=0; i<b.length; i++) { wrap.append('<div class="bar">' + b[i] + '</div>'); } var bar = $('.bar'); bar.css({ 'width': (100 / b.length) + '%', 'height': '100%' }) bar.each(function(i){ $(this).css({ 'background': 'rgb(255,' + (i*15) + ', 50)' }) }) if(input === ''){ bar.remove(); } } permute(input) });
});
Developer | John Urbank |
Username | jurbank |
Uploaded | July 08, 2022 |
Rating | 3.5 |
Size | 2,875 Kb |
Views | 46,552 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Hamburger subtract | 2,767 Kb |
CubeTronic | 3,716 Kb |
Canvas Geometry | 2,242 Kb |
Simple jQuery Slider | 2,874 Kb |
WebGL Minimalism | 2,940 Kb |
Navicon - responsive nav pattern | 3,469 Kb |
Traveling through Tron - Best viewed in Webkit | 3,195 Kb |
Mouse Trailing | 3,268 Kb |
Time is Money | 4,736 Kb |
Diagonal CSS Pattern | 1,790 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Css3 slide | Nakome | 3,190 Kb |
Css3 only dropdown menu | Riogrande | 2,519 Kb |
Word Wrap Algorithm for Multiline Canvas Text | Peterhry | 2,349 Kb |
Tail rose iris lined | Kbrtrm | 1,846 Kb |
Nested table email layout | Massimo-cassandro | 2,355 Kb |
Email Marketing Mock | Kristenzirkler | 8,224 Kb |
Animated rainbow wave on canvas | Icodeforlove | 2,777 Kb |
Pruebas de d3.js | Juanmanuelcarnerero | 2,485 Kb |
Octopus Bar iPad App Interactions | Davidkpiano | 6,735 Kb |
Sticky Navbar | Phantomesse | 5,106 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!