Skip to content

Instantly share code, notes, and snippets.

View martinrehfeld's full-sized avatar

Martin Rehfeld martinrehfeld

View GitHub Profile
@martinrehfeld
martinrehfeld / syslog_receiver.pl
Created March 11, 2014 14:33
Local syslog receiver
#!/usr/bin/perl
#
# UDP Listen ...
#
use IO::Socket::INET;
use strict;
my ($sock);
my $data;
# Copyright 2012 Erlware, LLC. All Rights Reserved.
#
# This file is provided to you 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
#
# Unless required by applicable law or agreed to in writing,
@martinrehfeld
martinrehfeld / Makefile
Created November 18, 2012 20:28 — forked from seth/Makefile
Template Makefile for Erlang projects
DEPS = $(CURDIR)/deps
DIALYZER_OPTS = -Wunderspecs
# List dependencies that should be included in a cached dialyzer PLT file.
# DIALYZER_DEPS = deps/app1/ebin \
# deps/app2/ebin
DEPS_PLT = {{name}}.plt
@martinrehfeld
martinrehfeld / integration_test_helper.rb
Created July 17, 2012 05:42 — forked from masone/integration_test_helper.rb
Headless integration testing of facebook dialogs with capybara-webkit

## Most important settings

Create a new facebook app (1) and make sure the canvas url (2) in the basic tab matches the host and port configured with Capybara.server_port and Capybara.app_host. Activating sandbox mode (3) in the advanced tab enables you to roll without providing an SSL canvas url. You want to set the display mode (4) of your facebook dialogs to page, which is also the default.

  1. https://developers.facebook.com/apps
  2. http://screencast.com/t/lt6ORnb1sf
  3. http://screencast.com/t/tPSUyE6s
  4. https://developers.facebook.com/docs/reference/dialogs/
@martinrehfeld
martinrehfeld / a.md
Created July 3, 2012 08:58 — forked from rkh/a.md

This allows you to use the following video streaming services outside of the US from your Mac without having to use a proxy or VPN, so no big bandwidth issues:

  • Netflix
  • Hulu / HuluPlus
  • CBS
  • ABC
  • MTV
  • theWB
  • CW TV
  • Crackle
@martinrehfeld
martinrehfeld / gist:2001434
Created March 8, 2012 15:10
SRC talk proposal 2012

Ruby & erlang -- A bond forged in the fires of idiomatic concurrency

Public description

In the world of social gaming, the classic 2-tier of web application does not cut it anymore. We need new and better solutions.

Follow along the evolution of game servers at Wooga and get an in-depth look into the next-generation backend putting the combined forces of erlang and Ruby to work. Learn how scalability, reliability, concurrency control and beautiful code do not need to be mutually exclusive.

Notes for the reviewers

@martinrehfeld
martinrehfeld / Gemfile
Created July 21, 2011 08:42
Erlang "autotest" -- run your eunit suites automatically when changing files (uses rebar + Ruby guard)
source 'http://rubygems.org'
group :development, :test do
gem 'guard-shell'
gem 'rb-fsevent'
gem 'growl'
end
var hasFlash = false;
if (navigator.plugins && navigator.plugins.length) {
if (navigator.plugins['Shockwave Flash']) {
hasFlash = true;
}
} else if (navigator.mimeTypes && navigator.mimeTypes.length) {
var mimeType = navigator.mimeTypes['application/x-shockwave-flash'];
hasFlash = mimeType && mimeType.enabledPlugin;
} else {
try {
@martinrehfeld
martinrehfeld / first.rb
Created June 20, 2010 17:57 — forked from mtodd/first.rb
A more clumsy take on breadcrumbs
def get_bread_crumb(request, separator = " » ", breadcrumb = [], so_far = '/')
url = request.respond_to?(:request_uri) ? request.request_uri : request
elements = url.split('/')
elements.each_with_index do |element, i|
is_last = i == elements.size - 1 # whether this is the last item or not
so_far += element + '/' # the URL for this element
breadcrumb << # append this element to the breadcrumb
case element
@martinrehfeld
martinrehfeld / application_helper.rb
Created June 20, 2010 17:54 — forked from indirect/application_helper.rb
Breadcrumbs helper -- requires inherited_resources gem
class ApplicationHelper
def breadcrumbs
result = "".html_safe
association_chain.each_with_index do |item, index|
# note that .name works for both classes and objects
result << link_to(item.name.humanize.titlecase, association_chain[0..index])
result << " &raquo; ".html_safe
end