Skip to content

Instantly share code, notes, and snippets.

View gms8994's full-sized avatar

Glen Solsberry gms8994

View GitHub Profile
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use HTML::Entities;
use iCal::Parser;
use LWP::UserAgent::Cached;
use Text::Table;
@gms8994
gms8994 / Laravel Select with data- Attributes
Created September 26, 2013 21:21
Laravel Select with data- Attributes
Form::macro('selectWithAttribs', function($name, $options, $default = null) {
$opt = array();
$select = '<select name="' . $name . '">';
foreach ($options as $option) {
$opt_node = '<option value="' . $option->value . '"';
$props = $option->getAttributes();
unset($props['value'], $props['key']);
#!/usr/bin/perl
use warnings;
use strict;
use CSS;
my $css = CSS->new({ 'parser' => 'CSS::Parse::Heavy', 'adaptor' => 'CSS::Adaptor::Debug' });
$css->read_file('bootstrap.css');
die $css->output();
my $css = CSS->new({ 'parser' => 'CSS::Parse::Heavy', 'adaptor' => 'CSS::Adaptor::Debug' });
$css->read_file($css_file);
die $css->output();
## core.php
/* Load Slim */
$app = new \Slim\Slim($app_config);
\Slim\Slim::registerAutoloader();
/* Validate API key */
$app->hook('slim.before', function() use ($app){
$authenticated = $app->request()->headers('X-API-KEY') == API_KEY;
if(! $authenticated) {
1) SchoolsTest::testAPIKeyInvalid
PHPUnit_Framework_Exception: exception 'ApiException' with message 'Authentication failed' in /mnt/hgfs/api-schools/vendor/learninghouse/api-core/lib/core.php:44
Stack trace:
#0 [internal function]: {closure}(NULL)
#1 /mnt/hgfs/api-schools/vendor/slim/slim/Slim/Slim.php(1089): call_user_func(Object(Closure), NULL)
#2 /mnt/hgfs/api-schools/vendor/slim/slim/Slim/Slim.php(1214): Slim\Slim->applyHook('slim.before')
#3 /mnt/hgfs/api-schools/vendor/slim/slim/Slim/Middleware/Flash.php(86): Slim\Slim->call()
#4 /mnt/hgfs/api-schools/vendor/slim/slim/Slim/Middleware/MethodOverride.php(94): Slim\Middleware\Flash->call()
#5 /mnt/hgfs/api-schools/vendor/slim/slim/Slim/Middleware/PrettyExceptions.php(67): Slim\Middleware\MethodOverride->call()
#6 /mnt/hgfs/api-schools/vendor/slim/slim/Slim/Slim.php(1174): Slim\Middleware\PrettyExceptions->call()
$app->hook('slim.before', function() use ($app){
$authenticated = $app->request()->headers('X-API-KEY') == API_KEY;
if(! $authenticated) {
throw new ApiException('Authentication failed');
}
});
@gms8994
gms8994 / gist:4286098
Created December 14, 2012 15:05
crontab for calendar_logger.scpt
19 8 * * * exec /usr/bin/osascript "calendar_logger.scpt" | grep -v "^$" | sort -k4 -k3 -k6 -k5 | /usr/local/bin/dayone -d="yesterday" new
tell application "Calendar"
tell calendar "Calendar"
set theStartDate to ((current date) - 1 * days)
set time of theStartDate to 1 * hours
set theEndDate to (current date)
set time of theEndDate to 1 * hours
set theEventListString to ""
set theEventList to every event where start date > theStartDate and end date < theEndDate
@gms8994
gms8994 / gist:3919797
Created October 19, 2012 18:21 — forked from adrienbrault/gist:1401812
Install coffee script compiler on CentOS

You are going to install some things. Login in root or use sudo for most of the followings commands.

su -

First you need git.

yum install git