Skip to content

Instantly share code, notes, and snippets.

View sam452's full-sized avatar

sam walton sam452

View GitHub Profile
@sam452
sam452 / artisan.php
Created February 19, 2016 20:05
dang PHP require. PHP sees the file, why is artisan not finding it?
#!/usr/bin/env php
<?php
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
@sam452
sam452 / console.txt
Created August 26, 2015 22:10
xdomain errors
XMLHttpRequest cannot load http://localhost:8080/RequestHandler.aspx?responseType=json&device=web&action=RETRIEVEMEMBERS&accessCode=1f410cdb-0a1d-4. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.
@sam452
sam452 / calendar_admin.module.php
Last active August 29, 2015 14:27
Managed_files in drupal forms
<?php
/**
* @file
* Admin module for managing builds
*/
function calendar_admin_menu() {
$items = array();
$items['calendar/admin/sponsor/new'] = array(
@sam452
sam452 / email_test.php
Created August 5, 2015 16:27
simple test for email on server.
<?php
if (strtoupper($_SERVER['REQUEST_METHOD'])=='POST') {
date_default_timezone_set('Etc/UTC');
require './PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 1;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
@sam452
sam452 / outputCSV.tpl.php
Last active August 29, 2015 14:26
Can a csv be a drupal template with a parameter?
<?php
echo "year = " . $year;
header("Content-Type: text/csv");
header("Content-Disposition: attachment; filename=file.csv"); // Disable caching
header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP 1.1
header("Pragma: no-cache"); // HTTP 1.0
header("Expires: 0"); // Proxies
$objects = re_dashboard_sendCSV($year);
@sam452
sam452 / donate.php
Last active August 29, 2015 14:25
pass output of js function into PHP form
<form method="post" action="confirmation.php" name="donationForm" id="donationForm" onsubmit="return validateAmount();">
<input type="hidden" id=
"my-frequency" name="frequency" value=
<?php echo '<script type="text/javascript"> myLastFrequency(); </script>'; ?>
/>
<button class="new-look-select-color new-look-submit-btn" data-pointer-submit="true" name="sbmit" type="submit" value="Submit">SUBMIT
</button>
rtmp://fms.12E5.edgecastcdn.net/0012E5/mp4:videos/8Juv1MVa-485.mp4
@sam452
sam452 / error.txt
Created May 26, 2015 13:51
entity_field_query
EntityFieldQueryException: Unknown field: vunetid in EntityFieldQuery->addFieldCondition() (line 779 of /media/psf/Home/apps/newdom/includes/entity.inc).
@sam452
sam452 / 5.4.34
Created May 18, 2015 21:31
phpbrew info
Version
PHP-5.4.34
Constants
PHP Prefix: /home/sam/.phpbrew/php/php-5.4.34
PHP Binary: /home/sam/.phpbrew/php/php-5.4.34/bin/php
PHP Default Include path: .:/home/sam/.phpbrew/php/php-5.4.34/lib/php
PHP Include path: .:/home/sam/.phpbrew/php/php-5.4.34/lib/php
General Info
@sam452
sam452 / migrate.php
Last active August 29, 2015 14:20
simple php migration fail
<?php
function convert($string) {
return strtotime($string);
}
$mysqli = mysqli_connect("osx", 'my_user', 'my+p1', 'my_host');
$res = mysqli_query($mysqli, "SELECT donationId, donationDate, donationTime from GeneralDonations where donationTime IS NULL");
// while ($row = mysqli_fetch_assoc($res)) {