Skip to content

Instantly share code, notes, and snippets.

View fwahlqvist's full-sized avatar

Fredrik Wahlqvist fwahlqvist

View GitHub Profile
@weierophinney
weierophinney / OAuth2PdoAdapter.php
Created October 9, 2014 20:30
Example of a custom ZF\OAuth2 PdoAdapter implementation.
<?php
namespace MyLib;
use ZF\OAuth2\Adapter\PdoAdapter;
class OAuth2PdoAdapter extends PdoAdapter
{
protected $mapper;
public function setUsersMapper(Users\MapperInterface $mapper)
@idosela
idosela / http-response-interceptor.js
Last active February 25, 2024 12:51
Sample code for ng-conf 2014
angular.module('myMdl', []).config(['$httpProvider', function($httpProvider) {
$httpProvider.responseInterceptors.push([
'$q', '$templateCache', 'activeProfile',
function($q, $templateCache, activeProfile) {
// Keep track which HTML templates have already been modified.
var modifiedTemplates = {};
// Tests if there are any keep/omit attributes.
var HAS_FLAGS_EXP = /data-(keep|omit)/;
@zoerooney
zoerooney / inline-validation.js
Last active December 17, 2015 21:09
Customized MailChimp code that works inline with WordPress. The JS goes in the footer - make sure to replace the URL on line 9 with the one from YOUR account (you can get it by grabbing the original version of this code - generate a "classic" embedded sign-up form and it'll be in there). There's also a bit you'll need to replace in the form code…
<script type="text/javascript">
var fnames = new Array();var ftypes = new Array();fnames[0]='EMAIL';ftypes[0]='email';fnames[1]='FNAME';ftypes[1]='text';fnames[2]='LNAME';ftypes[2]='text';
jQuery(document).ready( function($) {
var options = { errorClass: 'mce_inline_error', errorElement: 'div', onkeyup: function(){}, onfocusout:function(){}, onblur:function(){} };
var mce_validator = $("#mc-embedded-subscribe-form").validate(options);
$("#mc-embedded-subscribe-form").unbind('submit');//remove the validator so we can get into beforeSubmit on the ajaxform, which then calls the validator
options = { url: 'http://replace-with-your-specific-url', type: 'GET', dataType: 'json', contentType: "application/json; charset=utf-8",
beforeSubmit: function(){
@ezimuel
ezimuel / gist:5135662
Created March 11, 2013 16:55
DB2 configuration file connect using ZF2 and ODBC using config/autoload/local.php
<?php
$database = '';
$hostname = '';
$port = '';
$user = '';
$password = '';
return array(
'db' => array(
@fwahlqvist
fwahlqvist / readme.md
Created October 27, 2012 22:05 — forked from evo42/readme.md
Aloha Editor with textarea

Using Aloha Editor with your textarea

This is an example on how to use Aloha Editor with a traditional editable.

Note: If the textarea has a HTML ID (eg. mytxtarea) the ID of the Aloha editable will be “-aloha” suffixed (eg. mytxtarea-aloha).

For more information see the Aloha Editor Guide: http://aloha-editor.org/guides/core.html

@juriansluiman
juriansluiman / RFC.md
Created August 19, 2012 12:28
New Navigation module for Zend Framework 2

Proposal for a new navigation component

This document is a start to get a new navigation component of the ground. The current Zend\Navigation has shown to be a powerful component for navigation purposes. On the other hand, the code is since it's introduction in Zend Framework 1.8 not really updated. The complexity is for some features very difficult to comprehend. In ZF2, the overhaul of the view helpers made it even more difficult to customize the behaviour of Zend\Navigation.

The good parts:

  1. A structure of containers and pages to create hierarchal trees
  2. A set of domain layer-like objects (containers and pages) and view helpers to render them into html
  3. The option to mark pages as "active"
  4. The option to tune visibility of pages
  5. The option to attach an ACL object to the navigation list to show or hide parts based on access permission