Skip to content

Instantly share code, notes, and snippets.

View rlemon's full-sized avatar
🍋
Hanging around.

Robert Lemon rlemon

🍋
Hanging around.
  • Dryer Moisture Systems Inc.
  • Kitchener, Ontario. Canada.
View GitHub Profile
@rlemon
rlemon / html.html
Created July 4, 2016 18:53
html webcam capture example
<video id="video"></video>
@rlemon
rlemon / toggle-sidebars.chat.stackoverflow.js
Last active June 29, 2016 17:12
toggle sidebars script for chats
$('style').get(0).textContent += `
.sidebar-wrapper .toggle:not(.collapsed)::before {
content: 'hide ';
}
.sidebar-wrapper .collapsed::before {
content: 'show ';
}
.sidebar-wrapper .toggle {
background: transparent;
border: none;
@rlemon
rlemon / debounce.js
Created May 19, 2016 19:20
debounce js
function debounce(fn, time) {
let deltaTime = Date.now();
return function(event) {
if (Date.now() - deltaTime >= time) {
fn.call(this, event);
deltaTime = Date.now();
}
}.bind(this)
}
@rlemon
rlemon / poptart.js
Created April 14, 2016 17:09
php poptart
NodeList.prototype[Symbol.iterator] = [][Symbol.iterator];
new MutationObserver( rec => rec.map( n => [...n.addedNodes].map(parser) ) )
.observe(document.body, { childList: true, subtree: true });
[...document.querySelectorAll('.user-container .message')].map(parser);
function parser(node) {
if( node.classList && node.classList.contains('message') && !node.classList.contains('pending') ) {
if( /\bphp\b/gi.test(node.textContent ) ) {
node.innerHTML = node.innerHTML.replace(/\bphp\b/gi, 'Poptart');
}
}
@rlemon
rlemon / sleep sort.js
Created March 28, 2016 14:57
sleep sort
function sleepSort(stack) {
return new Promise( (resolve, reject) => {
let ret = [], len = stack.length;
const org = item => setTimeout(adder.bind(null, item), item);
const adder = item => ret.push(item) && ( (--len <= 0) && resolve(ret) );
stack.forEach(org);
});
}
@rlemon
rlemon / form.md
Created March 17, 2016 21:50
character bio form

CHARACTER BIO FORM

Character's Full Name: 
Reason or meaning of name: 
Nickname:                                     Reason for nickname: 
Birthdate: 
 
PHYSICAL APPEARANCE:
Age:                                                How old does s/he appear? 
Eye Color: Glasses or contacts: 

A stockboy is stacking fruit on a display, when a lady asks "Do you have any corn? " The stockboy replies "Sorry ma'am, we are out of corn, but we will be getting a shipment tomorrow morning" The lady looks around some more. A few mins later she runs back to him asking where the corn is. The stockboy confused about her mental state simply tells her "Sorry ma'am, we are out of corn, but we will be getting a shipment tomorrow morning" The lady looks around some more then goes back to the same stockboy and asks "Where the hell do you keep the corn, I need some corn right now!" The stockboy, getting frustated with his inability to explain the situation, tells the lady "Answers a couple of questions and I will get you your corn from the back." The lady agrees and the man starts the questions. "Spell cat for me, as in catastrophe " she says Ok, "C A T". "Very good!" the stockboy says, "now spell dog, as in dogmatic. " The lady getting frustrated spells it correct. Now the employee finally asks "now spell, Fuck

───────────────▄▄▄▄▄▄▄───────────
─────────────▄█▒▒▒█▒▒▒█▄─────────
────────────█▒▒▒▒▒▒▒▒▒▒█▌────────
───────────█▒▒▒▒▒▒▒▒▒▒▒▒█────────
───────────█▒▒▒▒▒▒▒▒▒▒▒█▌────────
──────────██████████████─────────
──────────█▒▒▒▒▒▒▒▒▒▒▒█▌─────────
─────────█▒████▒████▒▒█──────────
─────────█▒▒▒▒▒▒▒▒▒▒▒▒█──────────
─────────█▒────▒▒────▒█▌─────────
@rlemon
rlemon / tab-reply.js
Last active March 4, 2016 14:20
tab reply
"use strict";
const input = document.getElementById('input');
const chat = document.getElementById('chat');
input.addEventListener('keydown', processKeydown);
function processKeydown(event) {
if( event.which === 9 && input.value.length === 0 ) {
event.preventDefault();
const last = getLastReply();
@rlemon
rlemon / bulk-trash.js
Last active July 23, 2017 20:34
Bulk Trash
var btn = $('<button class="button">Bulk Trash</button>'),
room = document.forms[0].elements.room.value;
btn.on('click', function() {
var modal = $('<div><h4>Trash Who?</h4></div>'),
$users = $('#present-users:not(.more)').clone();
modal.append($users).addClass('popup room-popup').css({
bottom: btn.position().top,
left: btn.position().left
}).on('click', function(e) {
if (confirm("Would you like to trash all posts by " + e.target.title)) {