Skip to content

Instantly share code, notes, and snippets.

View leevigraham's full-sized avatar
🍹

Leevi Graham leevigraham

🍹
View GitHub Profile
@leevigraham
leevigraham / index.html
Created April 11, 2013 13:44
A CodePen by Leevi Graham.
<div id="page" class="box stacked">
<div class="primary toolbar">Toolbar</div>
<div class="box flex">
<div class="primary sidebar">
Width:
<button onclick="$(this).parent().width('+=100');">Increase</button>
<button onclick="$parent = $(this).parent(); if($parent.width() >= 200) { $parent.width('-=100') } ;">Decrease</button>
</div>
<div class="box stacked flex">
<div class="secondary toolbar">
<?php
$EE = get_instance();
$limit = $EE->input->get('show-all') ? 100 : 3;
?>
{exp:channel:entries limit="<?php print($limit); ?>"}{/exp:channel:entries}
@leevigraham
leevigraham / ssl-setup.sh
Last active April 8, 2018 02:50
Create Self Signed Certificate for Apache on OSX Mountain Lion: http://www.akadia.com/services/ssh_test_certificate.html
mkdir ~/Desktop/ssl
cd ~/Desktop/ssl
openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr
cp server.key server.key.org
openssl rsa -in server.key.org -out server.key
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
sudo cp server.crt /private/etc/apache2/server.crt
sudo cp server.key /private/etc/apache2/server.key
case ('admin' === $requestScopeDiscriminator) :
// Set default options for form control
$options = array(
'label' => 'Department',
'class' => 'MlfAppBundle:VenueDepartment',
'multiple' => true,
'endpointIndex' => array(
'mlf_back_end_venueDepartment_index',
array(
@leevigraham
leevigraham / gist:7062681
Created October 19, 2013 23:08
Print out the last day of the month with an interval optionally showing the end date.
<?php
$includeEndTime = true;
$interval = \DateInterval::createFromDateString('last day of next month');
$start = new \DateTime("last day of January 2000");
$end = new \DateTime("last day of December 2001");
if(true === $includeEndTime) {
$end->add($interval);
}
<?php
namespace Nsm\Bundle\ApiBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Hateoas\Configuration\Annotation as Hateoas;
use JMS\Serializer\Annotation as Serializer;
use Knp\DoctrineBehaviors\Model as ORMBehaviors;
{exp:nsm_category_heading
cat_url_title="{segment_2}"
channel="news"
}
{if no_results}{redirect="404"}{/if}
{if not_ajax}
{embed="site/_header"
title="{category_name_path}"
description="{category_description}"
@leevigraham
leevigraham / gist:10001829
Created April 6, 2014 05:22
Simple Node script to launch a Telnet connection and control my Pioneer Receiver.
var net = require('net');
connection = net.connect(23, '192.168.2.5')
connection.setEncoding('utf8');
connection.on('connect', function(){
console.log('connected');
connection.on('data', function(data){
console.log(data);
});
{% macro form_fields(form) %}
{% for field in form %}
{% if field.vars.block_prefixes[0] != 'button' %}
{{ form_row(field) }}
{% endif %}
{% endfor %}
{% endmacro %}
{% import _self as macros %}
@leevigraham
leevigraham / gist:922bcd86ebd30dd861d0
Last active July 21, 2018 03:59
OSX install Script
# Ask for the administrator password upfront
sudo -v
mkdir -p /Volumes/Sites/Work/Clients
mkdir -p /Volumes/Sites/Work/Internal
mkdir -p /Volumes/Sites/Personal
mkdir -p ~/Downloads/Torrents
xcode-select --install