Skip to content

Instantly share code, notes, and snippets.

View apathyboy's full-sized avatar

Eric Barr apathyboy

View GitHub Profile
if(@constant("_NO_CLI_")) {
if(@constant("_CAL_JOB_DEBUG_")) echo("going to ". @constant("_CAL_BASE_URL_") . $j ."\n");
// _ex_http_get(@constant("_CAL_BASE_URL_") . $j);
print "alec4";
} else {
# THIS IS WHERE I EXPECT THE PROBLEM TO BE WITH LOOPING JOBS, LETS TEST THIS
if(@constant("_CAL_JOB_DEBUG_")) {
echo("running ". mk_cmd_str("\"$php\" \"". @constant("_CAL_BASE_PATH_") . $j ."\"") ."\n");
echo(exec(mk_cmd_str("\"$php\" \"". @constant("_CAL_BASE_PATH_") . $j ."\"")));
}
#include <functional>
#include <iostream>
void f(int a, int b);
void g(int a, int b, float c, float d);
typedef std::function<void (int, int)> TestCallback;
int main() {
#!/bin/sh
function format_cpp {
file="${1}";
echo "${file}" | grep -ie "^.*\.cpp$" > /dev/null
if [ "$?" -eq 0 ]; then
if [ -f "${file}" ]; then
set -e
astyle -Q -z1 "${file}"
# Locate the Google C++ Testing Framework.
#
# Defines the following variables:
#
# GTEST_FOUND - Found the Google Testing framework
# GTEST_INCLUDE_DIRS - Include directories
#
# Also defines the library variables below as normal
# variables. These contain debug/optimized keywords when
# a debugging library is found.
@apathyboy
apathyboy / download_resources.sh
Created November 15, 2010 12:19
Downloads all the resources necessary to run an instance of the swganh mmoserver on a unix environment.
#!/bin/bash
basedir=$(cd $(dirname $0) && pwd)
# make the heightmaps directory if it doesn't exist
if [ ! -d $basedir/heightmaps ]; then
mkdir $basedir/heightmaps
fi
planets=("corellia"
@apathyboy
apathyboy / event_exploration.cc
Created December 1, 2010 23:05
Just a few ideas regarding events, no comments really however, just check out the main function and go from there. should compile as is in vc2010 in a new empty project.
/** This is a test application to explore ideas about an improved event
* implementation.
*
* \author Eric Barr <eric.barr@anhstudios.com>
*/
#include <cstdint>
#include <iostream>
#include <memory>
#include <string>
@apathyboy
apathyboy / event_exploration.cc
Created December 1, 2010 23:05
Just a few ideas regarding events, no comments really however, just check out the main function and go from there. should compile as is in vc2010 in a new empty project.
/** This is a test application to explore ideas about an improved event
* implementation.
*
* \author Eric Barr <eric.barr@anhstudios.com>
*/
#include <cstdint>
#include <iostream>
#include <memory>
#include <string>
@apathyboy
apathyboy / event_futures
Created December 5, 2010 06:42
Waiting to trigger an event until a collection of futures has returned.
dispatch.notify_when(server_started_event, [=] {
if (crafting.is_ready() && trade.is_ready() && travel_map.is_ready()) {
cout << "All startup tasks have finished, dispatch this event!\n";
return true;
}
return false;
});
@apathyboy
apathyboy / db c++
Created December 20, 2010 05:52
binding parameters
auto db_manager = make_shared<DatabaseManager>();
auto connection = db_manager->connect("mysql:host=localhost;schema=global", "swganh", "something");
auto statement = connection->prepareStatement("CALL sp_PersistSomeObject(:id, :name, :description)");
// bind values
statement->bindParam(":id", object->id());
statement->bindParam(":name", object->name());
statement->bindParam(":description", object->description());
@apathyboy
apathyboy / Burst run scripting
Created December 22, 2010 06:17
Psuedo code
// Scripting environment is supplied with the object id and invoking message
include 'components'
// Set up global data properties for this script.
properties.burst_run_modifier = 2;
properties.cooldown_delay_sec = 60;
properties.effect_duration_sec = 300;
// Check the state component to see if the running state is already set