Skip to content

Instantly share code, notes, and snippets.

View serbanghita's full-sized avatar
🏓

Şerban Ghiţă serbanghita

🏓
View GitHub Profile
@serbanghita
serbanghita / youtube-live-chat-sound-notification.js
Created November 4, 2023 13:13
Add sound notification to Youtube Live chat
(() => {
var audio = new Audio('https://freesound.org/data/previews/235/235911_2391840-lq.mp3');
audio.volume = 0.8;
audio.autoplay = false;
$('#chatframe').contentWindow.document.getElementById('item-scroller').addEventListener('scroll', function(obj) {
console.log(obj);
audio.play();
@serbanghita
serbanghita / selenium_animation.md
Last active April 11, 2022 17:55
Selenium - wait for an element's animation to finish
@serbanghita
serbanghita / codeSplitting.js
Created August 28, 2018 11:01 — forked from mgreer/codeSplitting.js
Code splitting HOC
// @flow
import * as React from 'react';
import {asyncComponent} from 'react-async-component';
export const loaderMaker = (bgColor: string = 'transparent') => () => (
<div style={{position: 'absolute', width: '100%', height: '100%', backgroundColor: bgColor}} />
);
const MAX_RETRIES = 3;
const STARTING_BACKOFF = 500;
abstract class Subject {
protected observers: Observer[] = [];
public addObserver(observer: Observer) {
this.observers.push(observer);
}
public removeObserver(observer: Observer) {
let found = this.observers.indexOf(observer);
if (found !== -1) {
@serbanghita
serbanghita / run.txt
Created January 4, 2018 10:00
Webpack with Dev Server
./node_modules/.bin/webpack-dev-server --open --watch-content-base
@serbanghita
serbanghita / dialogs.js
Last active May 4, 2016 15:25
Cordova Dialogs (Notifications)
var writeResult = function (property, value) {
var $result = document.createElement('div');
$result.innerHTML = '<b>' + property + ':</b> ' + value;
document.body.appendChild($result);
};
var createButton = function (label, callback) {
var $button = document.createElement('button');
$button.innerHTML = label;
$button.addEventListener('click', callback, false);
@serbanghita
serbanghita / cmds.md
Last active December 21, 2015 11:36
Get browser version on Windows

Open cmd.exe with/without administrator rights and type the commands below. Send me the output in the comments below. Thanks!

Google Chrome Canary

reg query HKEY_CURRENT_USER\Software\Google\Update\Clients\{4ea16ac7-fd5a-47c3-875b-dbf4a2008c20} | findstr /i pv

Google Chrome

@serbanghita
serbanghita / CrossBrowserConsoleLog
Created July 2, 2013 11:04
Cross Browser console.log implementation. I use this to be able to call log(arg1, arg2, ..., argN) in every browser.
// Cross-browser support for meaningful console.log
// @usage: log(arg1, arg2, ..., argN)
var log = function(){
if( console && console.log ) {
switch( typeof console.log ){
// Browser supports the function.
case 'function':