Skip to content

Instantly share code, notes, and snippets.

View my8bit's full-sized avatar
🔑
💀‎‍💻忍者🐒

Ihor Pavlenko my8bit

🔑
💀‎‍💻忍者🐒
View GitHub Profile
@my8bit
my8bit / index.html
Last active August 6, 2017 08:09 — forked from awildeone/index.html
jQuery Text Rotator
<h1> I am
<div id="rotate">
<div>awesome.</div>
<div>invincible.</div>
<div>unbeatable.</div>
<div>indestructible.</div>
</div>
</h1>
@my8bit
my8bit / most-common-word-in-text.js
Last active November 1, 2015 19:02 — forked from anonymous/index.html
Most common word in text. Simple algorithm.
var text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse iaculis nunc a quam condimentum, eget vestibulum magna aliquet. Cras a quam id odio congue viverra id nec purus. Proin in pharetra arcu. Aliquam vel vulputate urna. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec rutrum sem. Praesent a mi metus. Integer vitae facilisis nulla, a lacinia velit. Quisque tempor varius lectus nec finibus. Sed quis quam tempor justo mattis mattis. Proin vel ante risus. Sed maximus scelerisque commodo. Pellentesque ut placerat nisi.";
function findMostCommonWordInText(text) {
var wordCounter = {},
max = 1,
mostCommonWord = "";
text.split(" ").forEach(function(word) {
if (wordCounter[word]) {
wordCounter[word] += 1;
@my8bit
my8bit / Get only text nodes
Last active September 25, 2021 01:51 — forked from IceCreamYou/Inc 500 TSV
Get only text nodes inside dom element
/**
* Get an array containing the text nodes within a DOM node.
*
* From http://stackoverflow.com/a/4399718/843621
*
* For example get all text nodes from <body>
*
* var body = document.getElementsByTagName('body')[0];
*
* getTextNodesIn(body);
@my8bit
my8bit / hipchat_bot.js
Created October 2, 2012 22:40 — forked from powdahound/hipchat_bot.js
Basic XMPP bot example for HipChat using node.js
// Basic XMPP bot example for HipChat using node.js
// To use:
// 1. Set config variables
// 2. Run `node hipchat_bot.js`
// 3. Send a message like "!weather 94085" in the room with the bot
var request = require('request'); // github.com/mikeal/request
var sys = require('sys');
var util = require('util');
@my8bit
my8bit / CSS part
Created September 20, 2012 09:09 — forked from rakeshtembhurne/ajax file load
Ajax file load
#ajaxBusy {
display:none;
position: fixed;
z-index:999999;
height:99%;
width:99%;
background: url(../img/loading-icon-trans.gif) no-repeat 50% 50%;
}