Skip to content

Instantly share code, notes, and snippets.

class IntercoolerSupport
def initialize(controller)
@controller = controller
end
def request?
@controller.request.params['ic-request'] || ic_redirect?
end
@1cg
1cg / equality.gs
Created January 10, 2017 21:31
Helping understand different notions of equality
// gosu
var x = ...
var y = ...
if( x == y ) {
print("x and y are value equal, including null")
}
if( x === y ) { // note, triple equals!

Managing software complexity is among the most difficult tasks facing developers today. Picking tools and programming paradigms that assist in this task is of utmost importance, as system complexity tends to compound over time. Declarative programming has long been recognized as a practical programming paradigm for addressing complexity in software. In this talk we will examine how to apply this paradigm to the creation of modern web applications.

We will begin with a brief overview of intercooler.js, a library that supports building declarative modern web applications. We will discuss:

The core HTML attributes that drive an intercooler-based web application Declarative mechanisms for triggering AJAX requests Intercooler request and response formats, including custom HTTP Headers CSS Transitions Once we have covered these basics, we will examine a few typical web application UX needs and how they can be addressed using the declarative style:

@1cg
1cg / LOR Kai 2015.md
Created September 18, 2015 19:30
Kai Letter of Recommendation
@1cg
1cg / 1025 Fluent Proposal.MD
Last active September 18, 2015 17:36
1025 Fluent Proposal.MD

30 minute talk

Declarative AJAX - Minimizing Web Application Complexity

Description

Declarative programming has long been associated with clean and minimally complex code by describing what a program should achieve in terms of a problem domain, rather than describing how to achieve it as a sequence of primitive operations. In this talk we will go learn how to apply the declarative programming paradigm to modern web applications using intercooler.js, and will explore how to implement common modern web application UX patterns with it.

Abstract

@1cg
1cg / demo.gs
Created August 10, 2015 17:43
RagnarDB Validation prototyping
class ContactImpl {
function configure(config : IModelConfig) {
config.RequiredFields = {Contact#FirstName, Contact#LastName, Contact#Email}
config.PrimaryKey = Contact#Id
config.addValidator(Contact#Email, config.regExpValidator("/.*@.*/"))
}
}
@1cg
1cg / gist:75dcdef064ab2ca19ff6
Last active August 29, 2015 14:21
Javascript Programming Style
/*
I have been looking for a javascript programming style for a while that allows
me to program the way my java-and-ruby-oriented brain works without using any
third party libraries.
The following style gives me enough tools to build reasonably decoupled and testable
software that I have a shot at understanding later.
Is there a term for this style of javascript programming?
*/
def mimic_lemonstand_recurly_webhook(lead_email, purchase_amount, purchase_type, api_key)
get("https://api.leaddyno.com/v1/leads/by_email", {:email => lead_email, :key => api_key})
lead = JSON.parse(response.body)
if lead['affiliate'] != nil
get("https://api.leaddyno.com/v1/affiliates/" + lead['affiliate']['id'].to_s, {:key => api_key})
affiliate = JSON.parse(response.body)
<h3>LeadDyno Sharing Widget</h3>
<div class="row-fluid">
<div class="span12">
<p>
The LeadDyno Sharing Widget can be embedded on your product page or any other page on your website and will
automatically create an Amazon-style sharing widget with integrated click-tracking and integration with your
LeadDyno affiliate program.
</p>
</div>
classpath "org.gosu-lang.sparkgs:sparkgs:0.1-SNAPSHOT"
extends sparkgs.SparkFile
get("/", \-> "Hello World!")