Skip to content

Instantly share code, notes, and snippets.

View klaftertief's full-sized avatar

Jonas Coch klaftertief

View GitHub Profile
@klaftertief
klaftertief / reactiveconf-2016-lightning-talk.md
Last active April 2, 2024 20:17
An API search engine in Elm for Elm, proposal for a Lightning Talk at ReactiveConf 2016

An API search engine in Elm for Elm

Elm is a statically typed functional language that compiles to JavaScript. It's well-known for its developer experience: the compiler provides nice error messages, the package system enforces semantic versioning for all published packages and makes sure every exposed value or type has some documentation and type annotations.

module Decoder exposing (..)
import Json.Decode as Decode exposing ((:=))
import Json.Decode.Extra as Decode exposing ((|:))
type Foo
= Bar String Int
| Baz String Int
public function fetchNavigation(){
return array(
array(
'location' => __('System'),
'name' => __('Menu Item Name'),
'link' => '/link/',
'limit' => 'developer'
)
);
}
@klaftertief
klaftertief / AddExtension.sh
Created January 31, 2012 08:49
Use Symphony and Extensions as subtrees in your own project git repository.
#!/usr/bin/env bash
DEFAULT_BRANCH="master"
. .symbuilder
extensions=$webroot"/extensions/"
if [ $# -eq 1 ]
then
# get a name for new project from command line arguments
extension_name="$1"
@klaftertief
klaftertief / master.xml
Created September 30, 2011 14:27
My test snippet
<ssstudent_list>
<student>
<name>George Washington</name>
<major>Politics</major>
<phone>312-123-4567</phone>
<email>gw@example.edu</email>
</student>
<student>
<name>Janet Jones</name>
<major>Undeclared</major>
server {
server_name "~^((?<subdomain>www)\.)?(?<domain>location\.com)$";
index index.php index.htm index.html default.asp;
## Performs 301 redirects to non-www plus other minor things.
#include templates/server.main.conf;
# ----------------------------------------------------------------------->
# set main domain root to _
if ($subdomain = "") {
@klaftertief
klaftertief / gist:858462
Created March 7, 2011 12:48
reducing duplicator
/**
* @package assets
*/
(function($) {
/**
* This plugin creates a Symphony duplicator.
*
* @param {Object} custom_settings
@klaftertief
klaftertief / gist:857392
Created March 6, 2011 16:47
Clickable utilities in the XSLT editor
// Clickable utilities in the XSLT editor
$('#utilities li').click(function(event) {
if ($(event.target).is('a')) return;
var editor = $('textarea.code'),
lines = editor.val().split('\n'),
statement = '<xsl:import href="../utilities/' + $(this).find('a').text() + '"/>',
regexp = '^' + statement.replace('/>', '').replace('../utilities/', '(?:\.\./utilities/)?'),
newLine = '\n',
numberOfNewLines = 1,
public function grab(&$param_pool=NULL){
// I am not able to access $param_pool, so I'm taking a detour via Frontend::Page()
$page = Frontend::Page();
// CREATE XML DOCUMENT
$doc = new DOMDocument;
$root = $doc->createElement($this->dsParamROOTELEMENT);
$doc->appendChild($root);
// APPEND ARTICLES
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}