Skip to content

Instantly share code, notes, and snippets.

View Pamblam's full-sized avatar
🕶️
Coding

Rob Parham Pamblam

🕶️
Coding
  • Our Town America
  • Tampa Bay, Florida
View GitHub Profile
@Pamblam
Pamblam / Credit Card Generator
Last active August 14, 2023 14:33 — forked from B-Con/Credit Card Generator
Generate a valid random credit card number, CVV, issuer and expiration date
/**
* Generate a valid random credit card number, CVV, issuer and expiration date
*
* Original Copywrite/license:
*
* Copyright (c) 2015, Brad Conte (http: *bradconte.com)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@Pamblam
Pamblam / bs_template.html
Created June 27, 2017 14:13
A ready to go Bootstrap template using CDNs
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap Starter</title>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
function confirm(msg) {
return new Promise(function(yip, nip) {
var $div = $("<div>");
$div.html(msg);
$("body").append($div);
$div.dialog({
buttons: [{
text: "Yes",
icon: "ui-icon-heart",
click: function() {
@Pamblam
Pamblam / asyncPage.md
Created August 20, 2017 16:34
A class to trigger long running processes from the browser

asyncPage

asyncPage has 2 static methods.

Call asyncPage::startOutput() before sending anyoutput back to the client. This will start the output buffer.

Call asyncPage::sendOutput() after sending any output to the client. This will close a connection to the browser and allow you to run a long-running task afterwords without holding up the browser.

@Pamblam
Pamblam / PushNotifications.php
Last active September 12, 2017 19:10 — forked from trbsi/PushNotifications.php
Simple PHP class to send Android & iOS Push Notifications
<?php
/**
* Class to send a Push notification via Google or Apple in a single statment
*/
class Push{
/**
* Either the API Key from Google or the certificate passphrase from Apple
* @var string
@Pamblam
Pamblam / tapswipe.js
Created September 27, 2017 19:42
listen for tap and swipe on the same element, simultaneously...
/**
* listen for tap and swipe on the same element, simultaneously...
*/
let tapSwipe = (()=>{
var lastSwipe = 0;
return (ele, cb) => {
let isAction = false;
let downAt = {x:0, y:0};
let downHandler = (e) => {
downAt = {x: e.touches[0].pageX, y: e.touches[0].pageY};
@Pamblam
Pamblam / imgur_anon_upload.php
Last active November 16, 2017 15:30
PHP function for anonymous image upload using the Imgur API.
<?php
/**
* Anonymous image upload using imgur API
* @param $client_id String - The client ID (See: https://imgur.com/account/settings/apps)
* @param $img_path String - The path to image to be uploaded (or tempname of uploaded image)
* @return String|Bool - false on failure or URL of uploaded image on success.
*/
function imgur_anon_upload($client_id, $img_path){
if(!file_exists($img_path) || !is_readable($img_path)) return false;
@Pamblam
Pamblam / upScroller.js
Created January 19, 2018 17:05
This is a class that adds items to the top of an element when it's scrolled up, starting the element at the very bottom. See: https://stackoverflow.com/a/48346059/1444609
class upScroller{
constructor(ele = document.body){
this.renderedItems = 0;
this.ele = ele; var i=0;
this.initBoxContents();
}
initBoxContents(){
if(this.ele.scrollHeight == this.ele.clientHeight)
@Pamblam
Pamblam / isClickable.jQuery.js
Created January 31, 2018 02:54
Determine if the first element in a jQuery set is accessible to the user
/**
* Determine if the first element in a jQuery set is accessible to the user
*/
$.fn.isClickable = function() {
if (!this.length) return false;
const getZIndex = e => {
if (e === window || e === document) return 0;
var z = document.defaultView.getComputedStyle(e).getPropertyValue('z-index');
if (isNaN(z)) return getZIndex(e.parentNode);
@Pamblam
Pamblam / arrayChunk.js
Last active February 1, 2018 13:23
Break an array into chunks of a certain size
/**
* Break an array into chunks of a certain size
* @param {array} array - The array to break up
* @param {integer} chunksSize - The size of each subarray
* @returns {Array} - Array of subarrays
*/
function arrayChunk(array, chunksSize){
var i, j, chunk = chunksSize, chunks = [];
for (i = 0, j = array.length; i < j; i += chunk) {
chunks.push(array.slice(i, i + chunk));