An Elixir implementation of the output iterator/IntoIterator
idiom over Collectable and Arrays.
A simple PubSub adapter that sends messages between nodes over AMQP.
The app supervisor needs to be configured with:
{Phoenix.PubSub, name: App.PubSub, adapter: Phoenix.PubSub.AMQP, amqp: [connection: amqp_connection_id]},
This is a quick stab at a problem that the set_locale
package is supposed to solve but seems to be broken and unsupported, or at least that's what its issue list indicates.
We want to extract the locale from the path prefix; i.e. "/en/users"
and "/sv/users"
should correctly set the current Gettext locale for the request. "/users"
should keep the default locale.
We're not considering cookies or Accept-Language
in this scope. We also don't do redirecting; the unlocalized path will hit the action as usual.
Using this solution requires two changes to the router:
- Paths that should be localized need to be wrapped in a
localized/2
macro. It simply repeats its content with and without ascope /:locale
so that both versions are visible to the route inspector and play nicely with verified routes. - The browser pipeline needs to include a plug that extracts the param and sets the current Gettext locale. It also creates an assign for convenience.
I hereby claim:
- I am ulfurinn on github.
- I am ulfurinn (https://keybase.io/ulfurinn) on keybase.
- I have a public key ASAnUU569hnVj7NyM68L19fWt4pJlJzpPnUoOqyHnisfzwo
To claim this, I am signing this object:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A quick and dirty demo of talking HTTP over Unix domain sockets | |
package main | |
import ( | |
"fmt" | |
"io" | |
"net" | |
"net/http" | |
"os" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "dante" | |
require "amqp" | |
require "oj" | |
$0 = "My project generator" | |
Dir.chdir "/var/www/my-project" | |
Dante.run "my-project", pid_path: '/var/www/my-project-generator.pid', user: 'www-data', group: 'www-data' do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "amqp" | |
require "fiber" | |
module AMQP_RPC | |
module Client | |
def subscribe | |
response_queue.subscribe do |header, body| | |
id = header.correlation_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
### BEGIN INIT INFO | |
# Provides: thin | |
# Required-Start: $local_fs $remote_fs | |
# Required-Stop: $local_fs $remote_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: thin initscript | |
# Description: thin | |
### END INIT INFO |