Skip to content

Instantly share code, notes, and snippets.

<?php
class Bootstrap_Walker_Nav_Menu extends Walker_Nav_Menu {
function start_lvl( &$output, $depth ) {
//In a child UL, add the 'dropdown-menu' class
$indent = str_repeat( "\t", $depth );
$output .= "\n$indent<ul class=\"dropdown-menu\">\n";

The idea is to have nginx installed and node installed. I will extend this gist to include how to install those as well, but at the moment, the following assumes you have nginx 0.7.62 and node 0.2.3 installed on a Linux distro (I used Ubuntu).

In a nutshell,

  1. nginx is used to serve static files (css, js, images, etc.)
  2. node serves all the "dynamic" stuff.

So for example, www.foo.com request comes and your css, js, and images get served thru nginx while everything else (the request for say index.html or "/") gets served through node.

  1. nginx listens on port 80.
<?php
// Example of how to log into Google API with ClientLogin, good to use when you're not making a webapp.
// code taken and minimally updated from http://kovshenin.com/2009/10/google-docs-api-client-login-with-php-and-curl-1494/
// Construct an HTTP POST request
$clientlogin_url = "https://www.google.com/accounts/ClientLogin";
$clientlogin_post = array(
"accountType" => "HOSTED_OR_GOOGLE",
"Email" => "[email protected]",
@drucko
drucko / bg_typoscript.ts
Created April 4, 2013 17:44
Background-Images via TypoScript With IMG_RESOURCE you can manipulate an IMAGE via TYPO3 without outputting the whole img-Tag. IMG_RESOURCE creates an Image in typotemp (f.e. typo3temp/pics/134e7c7dd2.jpg). So you can use it then as an background-image.
page.90 = IMG_RESOURCE
page.90.file = fileadmin/Dog.jpg
page.90.file.width = 100
page.90.file.height = 100
page.90.stdWrap.wrap (
<div style="background-image:url(|); width:100px; height:100px;">Headline</div>
)
This is the result:
<!DOCTYPE HTML>
<!--
/*
* Remote File Copy Demo 1.0
*
* Copyright 2012, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
#!/bin/bash
#
# template script for generating CentOS container for LXC
#
#
# lxc: linux Container library
# Authors:
@drucko
drucko / gist:4945238
Last active December 13, 2015 17:08 — forked from chrismatthieu/gist:964754
Sip registrarserver with node.js
// Run Redis - cd redis-2.2.4 and run src/redis-server
var sip = require('sip');
var sys = require('sys');
var redis = require('redis');
var tropoapi = require('tropo-webapi');
//Trim leading and trailing whitespace from string values.
function trim(str) {
return str.replace(/^\s+|\s+$/g, '');
############################## django-auth-ldap ##############################
import ldap
from django_auth_ldap.config import LDAPSearch, PosixGroupType
# django-auth-ldap configuration starts here
AUTH_LDAP_SERVER_URI = "ldap://ldap.els03.loc ldap://ldap.zbw03.loc ldap://ldap.cvg03.loc"
#AUTH_LDAP_USER_DN_TEMPLATE = "uid=%(user)s,ou=People,o=loc"
# JW is in ou=Admin,o=loc so we search over o=loc to find him
AUTH_LDAP_USER_SEARCH = LDAPSearch("o=loc",
@drucko
drucko / gist:4421243
Created December 31, 2012 16:56 — forked from pindia/gist:3166678

Step by step from jQuery to Agility.js

There's probably hundreds of Javascript MVC frameworks out there. But my favorite, Agility.js, seems to be barely ever mentioned. Agility has served me well in several projects both big and small, so I'm writing a tutorial in the spirit of Step by step from jQuery to Backbone for Agility.

What makes Agility different from other MVC frameworks? In short, the lack of boilerplate and the completeness. Other frameworks involve many, many lines of boilerplate that provide a significant barrier to entry and detract from the readability of the final product. Agility minimizes this, lets you get started fast, and stays out of your way. But it doesn't sacrifice either completeness or maintainability. Agility is feature-rich, including two-way model-view bindings, declarative controller-events, prototypical inheritance, server persistance, and everything else

@drucko
drucko / fabfile.py
Created November 26, 2012 19:29 — forked from onyxfish/fabfile.py
Fabric configuration for advanced mapping w/ TileMill and invar
import os
import re
from fabric.api import *
import yaml
"""
Base configuration
"""
# Ubuntu