Skip to content

Instantly share code, notes, and snippets.

View adamlundrigan's full-sized avatar

Adam Lundrigan adamlundrigan

View GitHub Profile
@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.
@radmen
radmen / README.md
Created September 10, 2012 08:15
Apache vhost config for gitlab

unicorn config file

Edit file /home/gitlab/gitlab/config/unicorn.rb

Find line listen "#{app_dir}/tmp/sockets/gitlab.socket" and comment it. Uncomment line listen "127.0.0.1:8080"

required modules for apache

  • sudo a2enmod proxy
  • sudo a2enmod proxy_balancer
@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
{
<?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'
));
@rcorreia
rcorreia / drag_and_drop_helper.js
Last active August 11, 2023 06:41
drag_and_drop_helper.js
(function( $ ) {
$.fn.simulateDragDrop = function(options) {
return this.each(function() {
new $.simulateDragDrop(this, options);
});
};
$.simulateDragDrop = function(elem, options) {
this.options = options;
this.simulateEvent(elem, options);
};
@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;
@boucher
boucher / gist:1750375
Created February 6, 2012 07:09 — forked from siddarth/gist:1379745
Stripe PHP simple example
<?php
require 'path-to-Stripe.php';
if ($_POST) {
Stripe::setApiKey("YOUR-API-KEY");
$error = '';
$success = '';
try {
if (!isset($_POST['stripeToken']))
throw new Exception("The Stripe Token was not generated correctly");
@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

<?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'