Skip to content

Instantly share code, notes, and snippets.

View septor's full-sized avatar
👾

Patrick Weaver septor

👾
View GitHub Profile
@septor
septor / destinations.dart
Created December 10, 2022 14:21
Ticket To Ride Destinations
// Destination cards for Ticket To Ride.
// This is a snippet from a Flutter app I'm throwing together for scoring.
// This includes the US version as well as the Nordic version.
// This will be expanded as my collection of the versions increases.
class Destination {
String from;
String to;
int score;
<?php
/**
* @param string $url The URL to fetch
* @param boolean $json if true, returns decoded json array
* @param boolean $show_error if true, prints curl error to screen
* @author CodeBrauer <https://github.com/CodeBrauer>
* @return string result of fetched url, false on failure
*/
function curl_get_contents($url, $json = false, $show_error = false) {
if (!function_exists('curl_init')) { return file_get_contents($url); } // fallback
@septor
septor / admin_config.php
Created January 11, 2014 23:52
another attempt at a solution for issue #15 that works for e107 v1.0.4
<?php
/*
+---------------------------------------------------------------+
| e107 website system
| survey_config.php
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
+---------------------------------------------------------------+
*/
@septor
septor / download.php
Created January 7, 2014 14:24
Force download MP3
<?php
$file = ""; // file to download, you could use $_GET['file'] and include it in the URL somehow
header ("Content-type: octet/stream");
header ("Content-disposition: attachment; filename=".$file.";");
header ("Content-Length: ".filesize($file));
readfile($file);
exit;
?>
@septor
septor / survey.php
Created December 29, 2013 15:45
possible solution for issue #15 that works for e107 v1.0.4
<?php
/*
+---------------------------------------------------------------+
| e107 website system
| survey.php
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
+---------------------------------------------------------------+
*/
@septor
septor / pm.php
Created September 7, 2013 21:35
Remove unread PMs older than a year, and remove all PMs older than 5 years **THIS IS UNTESTED**
<?php
// drop this in your root e107 directory
include("class2.php");
// unread in the last 12 months
$sql->db_Delete("private_msg", "pm_sent < ".(time() - 31556926)." AND pm_read = 0") or die(mysql_error());
// older than 5 years
$sql->db_Delete("private_msg", "pm_sent < ".(time() - 157784630)) or die(mysql_error());
@septor
septor / tvrage.php
Last active December 16, 2015 00:49
Logically parse TVRage's "shows on tonight" RSS feed. Allows you to define a list of shows to be displayed. Display format is as follows: TIME SHOWNAME EPISODE -- 10:00PM Elementary (03x19)
<?php
// Display a list of configurable shows that is on today.
$showList = array
(
'Supernatural',
'Person of Interest',
'Elementary',
'The Five'
@septor
septor / wow.xml
Created January 7, 2013 01:28
Example Head Hunt Game XML file. Head Hunt will be a recruitment plugin for e107 that will support any number of games.
<?xml version="1.0" encoding="utf-8"?>
<headhunt>
<game name="World of Warcraft" stub="wow">
<victim name="Death Knight" color="c41f3b" image="deathknight.jpg">
<sub name="Blood" />
<sub name="2H Frost" />
<sub name="DW Frost" />
<sub name="Unholy" />
@septor
septor / birthdatename_menu.php
Created December 13, 2012 02:28
Display a user's real name and age in an e107 menu
<?php
if (!defined('e107_INIT')) { exit(); }
if(USER)
{
if($user = get_user_data(USERID))
{
$birthdate = $user['user_birthday'];
$realname = $user['user_login'];
@septor
septor / git_changelog.php
Created November 28, 2012 23:23
Last 20 e107 Project Commits -- GitHub
<?php
// Configuration ---------------------- //
$repo = "e107inc/e107";
$branch = "master";
// ------------------------------------ //
$git = simplexml_load_file("https://github.com/".$repo."/commits/".$branch.".atom");