Skip to content

Instantly share code, notes, and snippets.

View thinkadoo's full-sized avatar

Andre Venter thinkadoo

  • Freelance
  • Hermanus
View GitHub Profile

Setting up PHP on Mountain Lion from scratch

Editing text files from the command line is made easier with TextMate with it's command line extension mate OR Sublime text2 with command line extensions. However the built in nano text editor is easy to use as well.

Some guidance gleaned form from coolestguyplanettech.com

Change permissions on /Library/WebServer/Documents so all users can write to it

sudo chmod -R o+w /Library/WebServer/Documents

Project Deployment with Symfony2 & Angular.js

Symfony2 and Angular.js make a great, robust combintaion. Integrating them isn't immediately obvious, however. Both communities come with their own standards and suite of tools for managing the development process, and sometimes those tools conflict.

On the Symfony side, you mainly deal with composer for managing your dependencies, a few Symfony commands in your project, and any other tools you add into the mix, like phpunit.

On the Angular side, you'll probably end up using npm, bower and probably grunt for automating some of the pain.

The short answer

// Modifies $httpProvider for correct server communication (POST variable format)
angular.module('httpPostFix', [], function($httpProvider)
{
// Use x-www-form-urlencoded Content-Type
$httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8';
// Override $http service's default transformRequest
$httpProvider.defaults.transformRequest = [function(data)
{
/**
<!DOCTYPE html>
<html ng-app="rootApp">
<head>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.7/angular.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.9.0/ui-bootstrap-tpls.min.js"></script>
<meta charset=utf-8 />
<title>Bootstrap</title>
</head>
<body>
@thinkadoo
thinkadoo / MY_Controller.php
Last active December 17, 2015 23:59
Changed CIBonfire Admin_Controller to include returning media types from Module folder structure
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* Bonfire
*
* An open source project to allow developers get a jumpstart their development of CodeIgniter applications
*
* @package Bonfire
* @author Bonfire Dev Team
* @copyright Copyright (c) 2011 - 2013, Bonfire Dev Team
* @license http://guides.cibonfire.com/license.html
@thinkadoo
thinkadoo / content.php
Created June 2, 2013 09:35
Function assets for CIBonfire Controller - helps to serve css, js, images, ejs etc. from the module folder
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class content extends Admin_Controller {
//--------------------------------------------------------------------
public function __construct()
{
parent::__construct();
@thinkadoo
thinkadoo / assets.php
Created June 1, 2013 23:09
Module Assets Controller for CIBonfire HMVC
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class assets extends CI_Controller {
function __construct() {
parent::__construct();
Thanks to:
http://realityloop.com/blog/2012/07/03/nginx-mariadb-php-aegir-mac-os-x-optional-drush-5-works-mountain-lion
and
http://robots.thoughtbot.com/post/27985816073/the-hitchhikers-guide-to-riding-a-mountain-lion
--Fresh install Mountain Lion.
--Install XCode 4.4.2
--Install Command line utilities via Xcode
--Install Homebrew
try{
document.createEvent("TouchEvent");
// Here we're ensured touch capabilities
var scroll = document.getElementById('myid');
var start = null;
var clickIfEnd = true;
scroll.addEventListener('touchstart', function (e) {
start = e.touches[0].pageX;
clickIfEnd = true;
@thinkadoo
thinkadoo / post.md
Created November 18, 2012 15:55 — forked from kbond/post.md
Ubuntu PHP Development Environment Setup

Install git/subversion:

sudo apt-get install git subversion

Configure Git:

git config --global user.name "Your Name"
git config --global user.email "Your Email"

ssh-keygen -t rsa -C "Your Email"