Skip to content

Instantly share code, notes, and snippets.

@macbleser
macbleser / wp-permissions-script
Created February 21, 2014 15:37
WordPress Permissions Configuration Script
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro
#
WP_OWNER=changeme # <-- wordpress owner
WP_GROUP=changeme # <-- wordpress group
WP_ROOT=/home/changeme # <-- wordpress root directory
@m1r0
m1r0 / gist:8417210
Last active December 9, 2017 14:56
PHP-WP: Geocode address to lat and lng
function crb_get_lat_lng_by_address($address) {
$url = 'http://maps.googleapis.com/maps/api/geocode/xml?address=' . urlencode($address) . '&sensor=false';
$transient_key = substr(md5($address), 0, 20);
$coords_cache = get_transient( $transient_key );
if ( $coords_cache !== false ) {
return $coords_cache;
}
define([
'backbone',
'application',
'apps/my-app-mod/layout/my-app-mod-layout',
'apps/my-app-mod/my-app-mod-list',
'apps/my-app-mod/item/message-view',
'apps/my-app-mod/my-app-mod'
], function(Backbone, app, MyAppModLayout, MyAppModListController, MessageView, AppRouter) {
'use strict';
@Fasani
Fasani / Simple-Backbone-WordPress-Example.html
Last active February 4, 2022 04:38
A simple Backbone WordPress Example. Using JSON API plugin. (http://wordpress.org/plugins/json-api/)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Simple Backbone WordPress Example</title>
<link rel="stylesheet" href="base.css">
</head>
<body>
<ul id="post-list"></ul>
@tnajdek
tnajdek / fabfile.py
Created October 6, 2013 19:04
Fabfile for a python backend, js frontend project;
# -*- coding: utf-8 -*-
import logging
import os
from os.path import abspath, dirname, join
from os import environ
from fabric.api import env, task
from fabric.operations import local
from fabric.operations import sudo
from fabric.utils import puts
@dkleehammer
dkleehammer / app.js
Created July 31, 2013 22:08
Backbone/Marionette JS session handling example
define([
'marionette',
'router',
'controller',
'modules/auth',
'modules/vent',
'views/_layout'
], function(Marionette, Router, Controller, Auth, Vent, Layout){
var App = new Marionette.Application();
@mattkahl
mattkahl / twig.async.js
Last active March 16, 2017 08:23
An asynchronous implementation of twigjs that returns a Promise on instantiation if the template is asynchronous. Works just like twig(), but when instantiated, twigAsync returns a Promise. The twig template is passed as the only parameter when resolving the Deferred object.
/**
* twig.async.js
*
* An asynchronous implementation of twigjs that returns a Promise on instantiation if the template is asynchronous.
* Works just like twig(), but when instantiated, twigAsync returns a Promise. The twig template
* is passed as the only parameter when resolving the Deferred object.
*
* e.g.
* tpl = twigAsync({href:'/templates/profile/profile-welcomeNewDesign.twig'});
* $.when(tpl).done(function(twigTemplate){
@webgio
webgio / app.coffee
Last active December 10, 2023 10:24
Marionette.js module to manage authentication. Needs a server method that checks credentials returning true or false. Started from this blog post code: http://clintberry.com/2012/backbone-js-apps-authentication-tutorial/
App = new Marionette.Application();
App.addRegions {
"headerRegion": "#header"
"topMenuRegion": "#top-menu"
"mainRegion" : "#main"
}
App.on 'initialize:after', ->
Backbone.history.start()
@saniko
saniko / app.js file
Created October 11, 2012 16:59
a very simple bootstrap boilerplate for building backbone.marionette based on require.js
define([
'jquery',
'underscore',
'backbone',
'marionette',
'handlebars',
'text!templates/app_view.html',
'modules/mainMenuView/mainMenuView',
@aristofor
aristofor / makefile
Created June 28, 2012 10:22
custom bootstrap makefile
# makefile pour thème bootstrap personnalisé
#
# usage dans un makefile supérieur:
# $(MAKE) ${MAKEFLAGS} BUILD_DIR=${BUILD_DIR}/theme BOOTSTRAP_SOURCE=${BOOTSTRAP_SOURCE}
# ou dans ce makefile:
# BUILD_DIR=./build
# BOOTSTRAP_SOURCE=${HOME}/src/bootstrap
#
# bootstrap 2.1.0-wip utilise normalement `recess`
# `lessc` permet de surcharger localement des .less (option "--include-path")