Skip to content

Instantly share code, notes, and snippets.

View phpdave's full-sized avatar

UseTheForceDave phpdave

View GitHub Profile
appView.getView().setId(100);
appView.getView().setLayoutParams(new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
setContentView(appView.getView());
if (preferences.contains("BackgroundColor")) {
int backgroundColor = preferences.getInteger("BackgroundColor", Color.BLACK);
// Background of activity:
//run this in developer console on Firefox or firebug console in your browser. Appears to only work on Mac... will need the jquery selector updated
//scrapes https://dev.recurly.com/docs/
//Iterate over an array of objects we want to pick up based on h1 headers
var entities, entitieslength, i;
entities = ["Create Subscription","Account Object","Adjustment Object","Create Account's Billing Info (Token)","Create Account's Billing Info (Credit Card)","Create Subscription","Create Plan","Transaction Object"];
for (i = 0; i < entities.length; i++) {
console.log('/**');
console.log(' * '+entities[i]);
<?
//Create db connection
$hostname = "MYIBMI";
$user = "MYPROFILE";
$password = "";
$dbconn = new PDO("odbc:" . $hostname, $user, $password);
//SQL to run stored proc
$sql = "call #LALLAN.getCusInfo(?, ?, ?, ?)";
#Rewrite request to www.example.com/my.pdf to www.example.com/OutputPDFinPHP.php?PDFFile=my.pdf t
RewriteEngine on
RewriteRule ^(.*)\.pdf$ OutputPDFinPHP.php?PDFFile=$1 [NC]
#1 Get source
git clone git://github.com/xdebug/xdebug.git
#change to xdebug directory
cd xdebug
#2 setup environment variables for configure and make
export IBM_DB_HOME=/usr
export PHP_HOME=/usr/local/phpdave7
export PASE_TOOLS_HOME=/QOpenSys/usr
export AIX_TOOLS_HOME=/usr/local
@phpdave
phpdave / compileIconvPHPExtension.sh
Last active September 16, 2016 20:26
Compile iconv php extension on IBMi
#0.1 Do a find and replace for /usr/local/phpdave7 and switch it to your base installation path of php for example /usr/local/zendsvr
#0.2 Do a find and replace for /QOpenSys/litmis/ibmichroot/ and switch it to the directory where shr4.o or shr.o is. Run `find / -name shr4.o` if you need to locate this file.
#0.3 Do a find and replace for /usr/linux and switch it to the directory where your bin/iconv and lib/libiconv are located possibly /opt/freeware
#1.0 find your PHP Version
php -v
>PHP 5.6.7 (cli) (built: Apr 2 2015 15:32:22)
#2 get latest iconv php extension which is included in the php-src
git clone -b PHP-5.6.7 http://git.php.net/repository/php-src.git
<?
$email = '[email protected]';
$subject = "Here's a PDF";
$headers = "From: PDF Master <[email protected]>\r\nReply-To: [email protected]";
$headers .= "\r\nContent-Type: multipart/mixed; boundary=\"".$boundary."\"";
//build message with attachments
//message
$body = "Here's your PDFs!";
@phpdave
phpdave / PHPPDOIBMiConnection.php
Created September 2, 2016 19:47
Simple Example of making a PDO ODBC connection to an IBM i and running prepared statements
<?php
$hostname = "MYIBMI";
$user = "MYPROFILE";
$password = "";//leave blank and prompt. (works in windows not sure if it will work in other situations)
$pdoConnection = new PDO("odbc:" . $hostname, $user, $password);
$sql="SELECT * FROM MYLIB.MYTABLE WHERE NAME=:NAME AND CITY=:CITY";
$stmt = $pdoConnection->prepare($sql);
if (!$stmt)
{

One 250W Panel is ~17.5sq ft and produces about 303 kWh of energy in a year in Cleveland OH.

Tesla Model S has a 34kWh/100 MPGe rating.

If you drive 25 miles a day, Tesla is going to be using 8.5 kWh a day

25 miles/day * 34 kWh/100 MPGe * 365 days / year = 3102.5 kWh/year to drive 9125 miles/year

3102.5k kWh / 303 kWh/panel = 10.2 panels

@phpdave
phpdave / .htaccess
Last active August 27, 2016 18:31
enable gzip compression. Doesn't work on windstream. Also plugin "GZip Ninja Speed Compression" didn;t work
#enable compression
#Compression Attempt 1
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/javascript
<IfModule deflate_module>
# Enable compression for the following file types.
AddOutputFilterByType \
DEFLATE \
application/javascript \