Skip to content

Instantly share code, notes, and snippets.

View Bradleykingz's full-sized avatar
🤖
On the grind

Bradley K. Ochola Bradleykingz

🤖
On the grind
View GitHub Profile
@chrisjhoughton
chrisjhoughton / wait-el.js
Last active October 6, 2023 09:46
Wait for an element to exist on the page with jQuery
var waitForEl = function(selector, callback) {
if (jQuery(selector).length) {
callback();
} else {
setTimeout(function() {
waitForEl(selector, callback);
}, 100);
}
};
@joeyv
joeyv / PhoneNum.java
Last active September 21, 2023 13:41
Generates a random phone number
import java.util.*;
public class Phone
{
public static void main(String[] args)
{
int num1, num2, num3; //3 numbers in area code
int set2, set3; //sequence 2 and 3 of the phone number
Random generator = new Random();
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"