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
/**
* A disposable alert modal that uses Bootstrap
* https://jsfiddle.net/s9ojmwwt/2/
*/
function BSAlert(text){
var mid = "modal"+Math.floor(Math.random() * 10000000000000001);
var html = '<div class="modal fade" id="'+mid+'" tabindex="-1"'+
'role="dialog" aria-labelledby="myModalLabel" aria-hidden='+
'"true"><div class="modal-dialog"><div class="modal-conten'+
@Pamblam
Pamblam / rateBeggar.java
Created September 12, 2016 16:46
A class to ask user to rate appp if they have not done so.
package com.package.name;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.util.Log;
@Pamblam
Pamblam / API_TEMPLATE.php
Created April 5, 2017 17:09
Simple starting point for PHP webservices
<?php
session_start();
// Create the return array
$return = array(
"response" => "Success",
"success" => true,
"data" => array()
);
<?php
/**
* Given a string of PHP code, this will provide a list of classes, their
* constructors and the line number they're on. Used for programmatically
* updating older code using PHP4 style constructors to PHP7
*/
class classParser{
private $code;
private $tokens = array();
@Pamblam
Pamblam / processMonitor
Created June 1, 2017 14:47
Monitor and kill a process when it has been idle for 10 minutes (in this case, Oracle) - Written on mac, not tested on linux
#!/bin/bash
# The name of the process to search for and kill
PROCESSNAME="oracle";
# Determine if this script is currently running
if [ -f omstatus ]; then
# The status file exists, wait a second and see if it changes
CURRENTSTATUS=$(cat omstatus); sleep 2;
@Pamblam
Pamblam / RequestCache.php
Created June 8, 2017 16:54
Dynamically cache requests and responses in a single mysql table
<?php
/**
* Dynamically cache requests and responses in a single mysql table
*/
class RequestCache{
// Configurable Options
// The mysql options (except for $mysql_table) may be left blank if a $pdo
// connection is passed to the constructor.
@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