Skip to content

Instantly share code, notes, and snippets.

@MrMaksimize
MrMaksimize / closure
Created February 16, 2012 18:20
closure
<?php
$somefunction = function($foo, $bar){
//do something
}
$myfunction = ($somefunction($foo, $bar), $variable){
//do stuff
//call somefunction
//do some more stuff
@MrMaksimize
MrMaksimize / 2menus
Created February 14, 2012 15:25
menu to dropdown
//from https://github.com/MrMaksimize/DC2011/blob/mobile/sites/all/themes/chicago_2011/js/mobile_grid_response.js
function menuToDropdown(topContainer, ulClass, context){
if (context == 'mobile'){
$("<select />").appendTo(topContainer).addClass('mobile mobile-dropdown ' + topContainer.replace('#','') + '-mobile');
$('ul'+ulClass + ' li', topContainer).each( function(){
var el = this;
//construct optionString
var optionString = '<option value = "' + $('a', this).attr('href') + '" ';
if($(this).hasClass('active')){
@MrMaksimize
MrMaksimize / gist:1555783
Created January 3, 2012 16:58
node-nginx
server {
listen 80;
server_name git.mrmaksimize.com;
access_log /home/USERNAME/public_html/git.mrmaksimize.com/log/access.log;
error_log /home/USERNAME/public_html/git.mrmaksimize.com/log/error.log;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@MrMaksimize
MrMaksimize / gist:1402212
Created November 28, 2011 21:43
phpunit
# Author:: Mark Sonnabaum <mark.sonnabaum@acquia.com>
# Modifying Author:: Maksim Pecherskiy <max@allplayers.com>
# Recipe:: phpunit
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@MrMaksimize
MrMaksimize / gist:1401170
Created November 28, 2011 17:21
Building of DCCHI

The building Of DrupalCamp Chicago Site

This session will be a quick overview of how the DrupalCamp Chicago site was built. It will be done in a case study format where we will discuss some of the decisions we made, and why we made them.

We believe it would be helpful for beginners to have a walk through of the development of a conference site built from a distribution using features, as well as a mobile version for that site.

Erik created the design and pretty much built the whole site.

Matt provided the infrastructure and backend

@MrMaksimize
MrMaksimize / question.js
Created November 7, 2011 16:47
Question - js
//why does this work?
if ($('a:has(span.menu-description)', menu).size() > 0) {
menu.addClass('admin-toolbar-menu-hover');
$('a:has(span.menu-description)', menu).hover(
function() {
var link = $('<a></a>');
$(link).attr('class', $(this).attr('class'));
$(link).addClass('menu-hover')
.append($('span.menu-description', this).clone())
.appendTo(menu)
/*
* twitter-text-js 1.4.10
*
* Copyright 2011 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this work except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
@MrMaksimize
MrMaksimize / gist:1318731
Created October 27, 2011 03:35
services

#Oh the things you can do… with an API!

Most successful companies on the web today from Amazon to Dropbox to Google to Twitter expose some kind of API to their users to write their own applications and interact with their application programmatically. They expose an even deeper API for their internal teams.

Even Dries recognizes the importance of being able to output data in different formats and now Drupal has an awesome Web Services and Context Core Initiative

With Drupal, your site doesn't have to be big, or small, or even cool to have an API. It just has to be running Drupal! (So by definition it would be cool anyways).

In this session we'll delve into a discussion of APIs built using the Services Module. We'll talk about how internal APIs can be leveraged to transform your website into an SOA application and how external APIs can bring more adoption a