Skip to content

Instantly share code, notes, and snippets.

View alexweissman's full-sized avatar
💭
For the glory of the swarm

Alex Weissman alexweissman

💭
For the glory of the swarm
View GitHub Profile
@alexweissman
alexweissman / collegeparktutors.php
Last active February 6, 2016 02:35
Custom theme for integrating a Grav blog with a UF site
<?php
namespace Grav\Theme;
class CollegeParkTutors extends Antimatter {
public function onThemeInitialized(){
require_once realpath(ROOT_DIR . '/..') . '/app/vendor/autoload.php';
}
public function onTwigTemplatePaths() {
<?php
namespace UserFrosting;
use \Illuminate\Database\Capsule\Manager as Capsule;
/**
* CustomerRequest Class
*
* Represents a customer request from a frontend website.
@alexweissman
alexweissman / course-collection.css
Last active March 11, 2016 17:37
Course collection plugin
/* Styling for course collection */
.course-collection .col-button {
padding-top: 2px;
position: absolute;
top: 0;
left: 15px;
width: 30px;
}
.course-collection .col-button-offset {
@alexweissman
alexweissman / composer.json
Last active March 15, 2016 02:18
Using Rockettheme's Locator and Stream classes
{
"require": {
"php": ">=5.4.0",
"rockettheme/toolbox": "1.3.0"
}
}
public function fatalHandler() {
$error = error_get_last();
// Handle fatal errors
if( $error !== NULL && $error['type'] == E_ERROR) {
$errno = $error["type"];
$errfile = $error["file"];
$errline = $error["line"];
$errstr = $error["message"];
@alexweissman
alexweissman / sample-data.json
Last active May 20, 2016 16:48
load some kind of data from a JSON API into a dropdown menu
{
"count": 6,
"rows": [
{
"id": 1,
"name": "Indiana University Bloomington"
},
{
"id": 2,
"name": "Ivy Tech Bloomington"
@alexweissman
alexweissman / CheckEnvironment.php
Created May 24, 2016 19:59
check yoself before you wreck yoself
public function __invoke($request, $response, $next)
{
$problems_found = $this->problemChecker();
if ($problems_found){
$response = $this->view->render($response, 'pages/config-errors.html.twig', [
"messages" => $this->results
]);
} else {
$response = $next($request, $response);
@alexweissman
alexweissman / index.php
Created May 27, 2016 22:03
Tryina use Schema
<?php
use Illuminate\Database\Schema\Blueprint;
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
global $app;
$app->get('/install', function (Request $request, Response $response, $args) {
@alexweissman
alexweissman / collection_to_csv.php
Last active June 10, 2016 00:26
Converting an Eloquent collection to CSV
<?php
use \League\Csv\Writer;
$transform = function($collection) {
$collection->transform(function ($item) {
$item['institution'] = $item['institution']['name'];
$item['status'] = $item['status']['status'];
if ($item['latest_note']){
$item['latest_note_user'] = $item['latest_note']['user']['user_name'];
@alexweissman
alexweissman / config.cfg
Created June 30, 2016 17:48
Rockbox config file
# .cfg file created by rockbox 00a3658-160517 - http://www.rockbox.org
volume: -21
idle poweroff: 1
start directory: /<microSD1>/Music/
autoresume enable: on
eq enabled: on
dircache: off
fmr: /.rockbox/fmpresets/preset01.fmr
start in screen: wps