Skip to content

Instantly share code, notes, and snippets.

View adamlundrigan's full-sized avatar

Adam Lundrigan adamlundrigan

View GitHub Profile
<?php
// broken
class IndexControllerTest extends Zend_Test_PHPUnit_ControllerTestCase
{
public function setUp()
{
parent::setUp();
$this->bootstrap = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
@juriansluiman
juriansluiman / 1. Application.md
Created November 8, 2011 14:35
Modular application system for ZF2

Application system

This document describes how a system can be formed to set up modules in combination with a tree of pages stored in the database. The general idea is to have pages stored within a database in a tree structure, where every page is coupled to a module (1:n). Pages are queried and parsed to routes as a combination of the page route and the modules route(s).

Goal

Webapplications exist often with a frontend (for normal visitors) and backend (to manage the whole bunch). Also some pages might want to utilize the same module (two simple text pages as basic example). Thirdly, it should be easy for end users to create new pages, modify them or delete pages. To accomplish this, a robust system ("content management framework") should be made on top of zf2 to accomodate this.

Configuration

@prolic
prolic / acllistener.php
Created February 29, 2012 12:10
ACL Listener
<?php
namespace Application\Event;
use Zend\EventManager\StaticEventManager,
Zend\EventManager\EventDescription,
Application\Event\Exception\ForbiddenException,
Application\Event\Exception\UnexpectedValueException,
Humus\Di\Locator;
<?php
return array(
// ..
'service_manager' => array(
'factories' => array(
'translator_adapter' => function($serviceManager) {
return new Zend\Translator\Adapter\Tmx(array(
'locale' => 'auto',
'content' => __DIR__.'/../language/language.xml'
));
@macanderson
macanderson / CSS Prefixer
Created August 1, 2013 03:15
Python script to prefix all class and javascript files for bootstrap (version 3 supported)
#!/usr/bin/env python
from __future__ import print_function
import sys, re
import os.path
""" The CSS classname/namespace prefix to prepend to all Bootstrap CSS classes """
CSS_CLASS_PREFIX = 'ns-'
# Not all CSS classes that are referenced in JavaScript are actually defined in the CSS script.
@juriansluiman
juriansluiman / Module.php
Created July 11, 2012 13:14
Set a default locale for your application in Zend Framework 2
<?php
namespace Application;
use Locale;
use Zend\EventManager\Event;
use Zend\ModuleManager\Feature;
class Module implements
Feature\BootstrapListenerInterface
{
#!/usr/bin/env python2
# Author: Chris Dellin <cdellin@gmail.com>
# Date: 2016-09-14
# Script to scrape a working OAuth code from Google
# using the approach from dequis and hastebrot
# for use with hangups, purple-hangouts, etc.
# Requires packages python-gi and gir1.2-webkit-3.0 on Ubuntu 16.04.
@jdelisle
jdelisle / Module.php
Last active December 15, 2017 04:24
Query string parameters validation for Zend's Apigility resource fetchAll method using an event-based listener (inspired by zfcampus/zf-content-validation)
<?php
namespace Application;
use Zend\Http\Request;
use Zend\Mvc\MvcEvent;
use ZF\Apigility\Provider\ApigilityProviderInterface;
class Module implements ApigilityProviderInterface
{
public function getConfig()
@dotysan
dotysan / arin-rpki-roagen.sh
Last active May 24, 2018 16:23
How to create your keypair and ROAs.
#! /bin/bash -e
#
# notes on setting up RPKI hosted on ARIN
#
umask u=rwx,g=rx,o=
keys=ARIN-RPKI-keypair.pem
pubkey=ARIN-RPKI-pubkey.pem
hash openssl
@mrkrstphr
mrkrstphr / README.md
Last active February 5, 2019 13:17
Deploying Sculpin Sites to GitHub Pages

Deploying Sculpin Sites to GitHub Pages

I wanted to be able to use Sculpin to generate GitHub pages. Here's what I did...

  1. Created a super awesome Sculpin site from the Sculpin Blog Skeleton

  2. Make sure everything is under version control in my master branch (except things that shouldn't be. see the .gitignore)

  3. Updated publish.sh:

#!/bin/bash