Skip to content

Instantly share code, notes, and snippets.

View evanpurkhiser's full-sized avatar

Evan Purkhiser evanpurkhiser

View GitHub Profile
void LinkedList<T>:reversePrint(ListNode<T> *node = false) {
if (node == false)
node = head;
if (node == null)
return;
reversePrint(node->next);
cout << node->value << " ";
}
vod LinkedList<T>:reversePrint() {
return reversePrintRecurse(head);
}
void LinkedList<T>:reversePrintRecurse(ListNode<T> *node) {
if (node == null)
return;
reversePrint(node->next);
cout << node->value << " ";
void LinkedList<T>:reversePrint(ListNode<T> *node = null, bool start = true) {
if (start == true)
node = head;
if (node == null)
return;
reversePrint(node->next, false);
cout << node->value << " ";
}
@evanpurkhiser
evanpurkhiser / auth.php
Created May 3, 2012 05:24
Authentication on an oustide file
<?php
return array(
'username' => 'username',
'password' => 'password',
'hostname' => 'example.com',
);
// usage: $auth = include("this-file.php");
<?php
error_reporting(E_ALL | E_STRICT);
Class lotto{
private $_connection;
function __construct()
{
$auth = include("login.php");
<?php
class Model_Student_Profile extends ORM {
/**
* Model validation rules
*/
public function rules()
{
return array(
@evanpurkhiser
evanpurkhiser / kohana.php
Created June 4, 2012 23:54
Fix kohana CLI checks
// More reliably determin if php is in CLI mode
Kohana::$is_cli = isset($_SERVER['SHELL']) OR kohana::$is_cli;
Exception: STATUS_ACCESS_VIOLATION at eip=61004D96
eax=00000000 ebx=610050DD ecx=12810000 edx=0065E8B8 esi=FFFFFFFF edi=00000000
ebp=10000000 esp=029FACDC program=C:\cygwin2\bin\bash.exe, pid 2712, thread unknown (0xFA4)
cs=0023 ds=002B es=002B fs=0053 gs=002B ss=002B
Stack trace:
Frame Function Args
10000000 61004D96 (00000004, 0000FFFF, 000000B8, 00000000)
00905A4D 00000003 (00000000, 00000000, 00000000, 00000000)
End of stack trace
Cygwin Configuration Diagnostics
Current System Time: Sun Jun 24 22:06:58 2012
Windows 7 Professional N Ver 6.1 Build 7601 Service Pack 1
Running under WOW64 on AMD64
Path: C:\Program Files (x86)\gdipp\
C:\Program Files (x86)\gdipp\
3 3 [main] bash (3312) **********************************************
186 189 [main] bash (3312) Program name: C:\cygwin2\bin\bash.exe (windows pid 3312)
38 227 [main] bash (3312) OS version: Windows NT-6.1
30 257 [main] bash (3312) Heap size: 3082204596
28 285 [main] bash (3312) **********************************************
1031 1316 [main] bash (3312) sigprocmask: 0 = sigprocmask (0, 0x61243308, 0x610F9BE0)
401 1717 [main] bash 3312 open_shared: name shared.5, n 5, shared 0x60FF0000 (wanted 0x60FF0000), h 0x78, *m 6
132 1849 [main] bash 3312 heap_init: heap base 0x20000000, heap top 0x20000000
52 1901 [main] bash 3312 open_shared: name S-1-5-21-1210431737-3251567494-2947978243-1000.1, n 1, shared 0x60FE0000 (wanted 0x60FE0000), h 0x74, *m 6
31 1932 [main] bash 3312 user_info::create: opening user shared for 'S-1-5-21-1210431737-3251567494-2947978243-1000' at 0x60FE0000