Skip to content

Instantly share code, notes, and snippets.

@mikemadisonweb
mikemadisonweb / pedantically_commented_playbook.yml
Created July 17, 2016 11:19 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
@mikemadisonweb
mikemadisonweb / tailrecursion.php
Created July 19, 2016 06:44 — forked from beberlei/tailrecursion.php
PHP Tail Recursion
<?php
class TailRecursion
{
public $func;
public $acc;
public $recursing;
public function tail()
{
return call_user_func_array($this->func, func_get_args());

#Introduction If you're a php developer on ubuntu, there comes the time where you have to install/reinstall your system. I did it already a few times and i decided to write down the steps for a typical web developer stack with php. This is for a developer machine and not for a live environment!

I hope it helps you too!

fyi @mheiniger and me started with an installer here: https://github.com/mheiniger/webdev-setup

@mikemadisonweb
mikemadisonweb / transaction.php
Created July 28, 2016 11:49 — forked from datacow-com/transaction.php
How to make transactions in Doctrine 2 using Symfony 2
<?php
// Snippet for Symfony 2 application that uses Doctrine 2 to handle transactions
// It uses the names of the objects/doctrine repositories from the Beta 4 Manual of Symfony 2.
// Get the entity manager
$em = $this->getDoctrine()->getEntityManager();
// suspend auto-commit
$em->getConnection()->beginTransaction();
@mikemadisonweb
mikemadisonweb / baseConverter.js
Created August 15, 2016 11:55 — forked from faisalman/baseConverter.js
Convert From/To Binary/Decimal/Hexadecimal in JavaScript
/**
* Convert From/To Binary/Decimal/Hexadecimal in JavaScript
* https://gist.github.com/faisalman
*
* Copyright 2012-2015, Faisalman <[email protected]>
* Licensed under The MIT License
* http://www.opensource.org/licenses/mit-license
*/
(function(){
@mikemadisonweb
mikemadisonweb / Paypal.php
Created August 23, 2016 07:26 — forked from danvbe/Paypal.php
Sonata PayPal issue fix
<?php
/**
* Created by PhpStorm.
* User: danvbe
* Date: 7/25/14
* Time: 2:49 PM
*/
namespace Application\Sonata\PaymentBundle\Component;
@mikemadisonweb
mikemadisonweb / 1-Explanations.md
Created August 23, 2016 07:27 — forked from danvbe/1-Explanations.md
A way to integrate FosUserBundle and HWIOAuthBundle

I have managed to install this… and make it work. I implemented it for Facebook and Google, but you can extend it. My solution it is mostly as described in #116, with a bit of more code presented. The key aspects that lack in the #116 presentation (IMO) are:

  • the registration as service of your custom FOSUBUserProvider (with the necessary parameters)
  • set the service for oauth_user_provider in the security.yml with your custom created service

Here are the steps:

  1. Routing. In routing.yml I have added all the routes for both bundles.
  2. Configuration. I have set the config.yml mostly as it is presented in the HWIOAuthBundle.
  3. Security. I have set the security.yml mostly as it is presented in the HWIOAuthBundle (though my routes are using /login pattern, not /connect). Also, the oauth_user_provider is set for my custom service.
@mikemadisonweb
mikemadisonweb / LinkedList.class.php
Created August 24, 2016 13:23 — forked from zachflower/LinkedList.class.php
PHP implementation of a singly linked list.
<?php
class Node {
public $data = NULL;
public $next = NULL;
public function __construct($data = NULL) {
$this->data = $data;
}
}
@mikemadisonweb
mikemadisonweb / BinarySearchTree.class.php
Created August 24, 2016 13:24 — forked from zachflower/BinarySearchTree.class.php
PHP implementation of a binary search tree.
<?php
class Node {
public $level = 1;
public $data = NULL;
public $left = NULL;
public $right = NULL;
public function __construct($data = NULL) {
$this->data = $data;
@mikemadisonweb
mikemadisonweb / Stack.class.php
Created August 24, 2016 13:24 — forked from zachflower/Stack.class.php
PHP implementation of a stack.
<?php
// http://www.cplusplus.com/reference/stack/stack/
class Stack {
private $_stack = array();
public function size() {
return count($this->_stack);
}