Skip to content

Instantly share code, notes, and snippets.

(re-frame/reg-fx
::send-several-ws
(fn [[websocket payloads]]
(doseq [p payloads]
(.send websocket (js/JSON.stringify (clj->js p))))))
(re-frame/reg-event-fx
::subscribe
(fn [{:keys [db]} [_ subscription-id query variables callback-event initial-payload :as event]]
@gabrielnau
gabrielnau / example.cljs
Created October 15, 2016 06:35
re-frame-http-fx usage
(reg-event-fx
:http-request
(fn [{:keys [db]} [_ {:keys [method uri on-success on-failure params]}]]
{:db db
:http-xhrio {:method method
:uri uri
:params params
:on-success on-success
:on-failure on-failure
:headers {"X-CSRF-Token" csrf-token}
@gabrielnau
gabrielnau / Int64.js
Created September 25, 2015 08:12 — forked from lttlrck/Int64.js
64-bit Integer type for Javascript based on Int64.js but NodeJS dependency on buffer removed, plus some other small mods.
// Int64.js
//
// Copyright (c) 2012 Robert Kieffer
// MIT License - http://opensource.org/licenses/mit-license.php
/**
* Support for handling 64-bit int numbers in Javascript (node.js)
*
* JS Numbers are IEEE-754 binary double-precision floats, which limits the
* range of values that can be represented with integer precision to:
@gabrielnau
gabrielnau / SassMeister-input-HTML.html
Created July 22, 2014 11:12
Generated by SassMeister.com.
<html>
<body>
<div class="topbar">A top bar</div>
<div class="content">
Content ...
</div>
</body>
</html>
@import "compass/reset"
@import "compass/typography/vertical_rhythm"
// Main baseline
$base-font-size: 20px
$base-line-height: 30px
// Alternative baseline
$alt-font-size: 10px
$alt-line-height: 15px
@gabrielnau
gabrielnau / 1- classic templating
Created October 18, 2012 14:11
Locomotive CMS Guide - Templating
+- Views
+- layout
+- application
+- mysite
+- index
+- first page
+- second page
@gabrielnau
gabrielnau / index.liquid.html
Created May 13, 2012 16:35
Locomotive CMS book / Templating / Liquid Syntax / Objects / Site
<html>
<head>
<title>{{ site.seo_title }}</title>
<meta name='description' content='{{ site.meta_description }}' />
<meta name='keyword' content='{{ site.meta_keywords }}' />
</head>
<body>
</body>
</html>
@gabrielnau
gabrielnau / index.liquid.html
Created May 13, 2012 15:32
Locomotive CMS book / Templating / Templating logic / Going further / Snippets
<html>
<head>
<title>Snippet example</title>
</head>
<body>
<header>
</header>
<div id="content">
<!-- Loop on products -->
{% for product in contents.products %}
@gabrielnau
gabrielnau / alternate_layout.liquid.html
Created May 13, 2012 14:57
Locomotive CMS book / Templating / Templating logic / Going further / Several layouts
<html>
<head>
<title>The Alternate Layout</title>
</head>
<body>
<header>
Alternate header
</header>
<div id="content">
{% block alternate_content %}
@gabrielnau
gabrielnau / a-page.liquid.html
Created May 13, 2012 11:27
Locomotive CMS book / Templating / Templating logic / Basics
{% extends parent %}
{% block content %}
the content of this page
{% endblock %}