Skip to content

Instantly share code, notes, and snippets.

View schorsch's full-sized avatar

Georg Leciejewski schorsch

View GitHub Profile
# From http://blog.teamschnitzel.com/2007/05/14/haml-parsing-for-ruby-gettext
require 'gettext/tools/rgettext'
module HamlParser
module_function
def target?(file)
File.extname(file) == ".haml"
end
@schorsch
schorsch / gist:134652
Created June 23, 2009 16:24
Rails Form helper to ease the rendering of nested_forms via accepts_nested_attributes_for
module KingForm
# Method for building forms that contain fields for associated models.
module NestedFormHelper
# Renders the form for nested objects defined via activerecord accepts_nested_attributes_for
#
# The associated argument can be either an object, or a collection of objects to be rendered.
#
# An options hash can be specified to override the default behaviors.
@schorsch
schorsch / SalesKing-oAuth-PHP-Example.php
Last active September 25, 2015 01:47
Minimal example of how to authenticate a SalesKing app
<?php
$app_id = "APP_CLIENT_ID";
$app_secret = "APP_SECRET";
$app_url = "http://localhost/oauth_test";
$app_scope = "api/clients:read";
$sk_url = "https://SUBDOMAIN.salesking.eu";
$code = $_REQUEST["code"];
if(empty($code)) { # redirect to authorize url