Skip to content

Instantly share code, notes, and snippets.

@arjan
arjan / gist:5974897
Created July 11, 2013 12:08
Given 0-based column number return the Excel column name.
%% Given 0-based column number return the Excel column name as list.
column(N) ->
column(N, []).
column(N, Acc) when N < 26 ->
[(N)+$A | Acc];
column(N, Acc) ->
column(N div 26-1, [(N rem 26)+$A|Acc]).
Andreas Stenius (21):
* doc: renamed sidebar template to be more generic.
* doc: add links to other versions of the docs.
* doc: rename link to 0.9
* doc: fix version links.
* doc: removed a tag from the version being browsed.
* doc: update frontend-growl cookbook entry.
* zotonic-tpl-mode: fix for indenting consequtive closing template tags.
* zotonic-tpl-mode: bind C-M-\ to zotonic-tpl-indent-buffer.
@arjan
arjan / gist:4450884
Last active December 10, 2015 14:58
rebarizing zotonic
Make each module and each site an Erlang (library) app.
This means that each module should be structured like this:
├── dispatch
├── ebin
├── lib
│   ├── css
│   ├── images
├── src
│   ├── actions
@arjan
arjan / not so short
Created December 17, 2012 14:35
zotonic 0.9 shortlog
Ahmed Al-Saadi (1):
* Removed websocket response header to conform to the latest proposed websocket protocol standard (see http://tools.ietf.org/html/rfc6455#section-4.2.2, December 2011)
Alain O'Dea (2):
* installmodule: Halt on failure to clone Fixes #404
* installmodule: Halt on failure to clone
Andreas Stenius (142):
@arjan
arjan / gist:4318674
Created December 17, 2012 14:29
release notes 0.9.0

Release 0.9.0

Welcome Zotonic 0.9.0, released on December 17, 2012. These notes list the most important changes for this new feature release.

@arjan
arjan / worker.erl
Created December 14, 2012 09:09
Erlang shell script to do some work in parallel on a number of input files. Parallelism is limited by the NumWorkers variable.
#!/usr/bin/escript
%% -*- mode: erlang -*-
main(Files) ->
NumWorkers = 3,
Parent = self(),
Workers = [spawn_link(fun() -> worker(Parent) end) || _ <- lists:seq(1, NumWorkers)],
@arjan
arjan / gist:4054387
Created November 11, 2012 10:17
Starting espotify
ok = espotify_api:start(self(), "/tmp/espotify_nif", "/tmp/espotify_nif",
"user", "password"),
@arjan
arjan / gist:3332063
Created August 12, 2012 14:25
zotonic 2.0

The main idea is to split off Zotonic's functionality in a set of OTP apps. Each site will become its own app. Modules are treated specially. They are also erlang apps, containing a simple-one-for-one supervisor, in which each child process is an actual running instance of the module for a specific site.

The most powerful feature of zotonic is its extensibility and flexibility. Zotonic consists of one or more sites, each of which use functionality which is contained in modules. In the site context, tools exist to communicate between these through notifications: a prioritized publish/subscribe mechanism for the exchange of messages through maps and folds.

The z_core app will consist of functions for starting/stopping sites and modules, broadcasting notifications within sites, and code for the indexing of the module files (e.g. for template finding; z_module_indexer). For sites and modules, behaviours will be created to reduce the amount of boilerplate code when implementing sites/modules.

{% wire id="basket-form" type="submit" postback={add_to_cart id=id variant_id=variant_id action={redirect location="/cart"}} delegate="mod_shop" %}
<form id="basket-form" method="post" action="postback">
<table>
<tr>
<th>
Color
</th>
<td>
{% for id in id.o.has_variant %}
<a class="variant-link {% if id == variant_id
@arjan
arjan / git-submodule-updated
Created May 16, 2012 08:48
Automatically update and commit a parent repository when a submodule changed
#!/bin/bash
# Arjan Scherpenisse, 2012-05-16
#
# Automatically update and commit a parent repository when a submodule changed
DIR=$(dirname $PWD)
PART=$(basename $PWD)
cd ..