Instantly share code, notes, and snippets.

View ring.logger.cambium.clj
(ns ring.logger.cambium
(:require
[cambium.core :as log]
[ring.logger.messages :as messages]
[ring.logger.protocols :refer [Logger]]
[ring.logger :as logger]))
(defrecord CambiumLogger []
Logger
View employee-stats.clj
(def employee-stats
(xf/transjuxt
{:billable-hours (comp billable-hours (xf/reduce +))
:startups-hours (comp startups-hours (xf/reduce +))
:non-billable-without-edu-hours (comp non-billable-without-edu-hours (xf/reduce +))
:without-allocation-hours (comp without-allocation-hours (xf/reduce +))
:education-hours (comp education-hours (xf/reduce +))
:time-off-hours (comp time-off-hours (xf/reduce +))
:projects-count (comp significant-projects xf/count)}))
View console.cljs
(ns methyl.console
"Helper functions for logging.
Logging is enebled only when `goog.DEBUG` symbol is defined with value equal to `true`."
(:refer-clojure :exclude [time]))
(def
^{:docs
"Displays a message in the console. Pass one or more objects to this method.
Each object is evaluated and concatenated into a space-delimited string.
View react-router-async-match.js
import match from 'react-router/lib/match';
const matchResult = (resolve, reject) => (err, redirectLocation, renderProps) => err ? reject(err) : resolve({redirectLocation, renderProps});
const matchExecutor = ctx => (resolve, reject) => match(ctx, matchResult(resolve, reject));
export default ctx => new Promise(matchExecutor(ctx));
View observable-history.js
import {Observable} from 'rxjs/Observable';
import {Subscription} from 'rxjs/Subscription';
import {map} from 'rxjs/operator/map';
import useRouterHistory from 'react-router/lib/useRouterHistory';
import createTransitionManager from 'react-router/lib/createTransitionManager';
import {stringify, parse} from 'qs';
const RAILS_QUERY_FORMAT = {arrayFormat: 'brackets'};
const stringifyQuery = query => stringify(query, RAILS_QUERY_FORMAT).replace(/%20/g, '+');
const parseQueryString = query => parse(query, RAILS_QUERY_FORMAT);
View .babelrc
{
"env": {
"bundle": {
"compact": false,
"comments": false,
"plugins": [
"add-module-exports",
"transform-runtime",
"transform-strict-mode",
"transform-object-rest-spread",
View server.js
const updateState = app => m => app.updateData(app.state.withMutations(m));
const cleanup = app => ::app.dispose;
export default function(apiUrl, gtmKey) {
const api = apiFactory(apiUrl);
const data = fromJS(appState);
return async (req, res, next) => {
try {
const app = new Application(data);
const routes = defRoutes(app);
View user.keymap.clj
[
[:app "cmd-t" :workspace.show]
[:app "cmd-shift-f" :searcher.show]
[:app "cmd-shift-k" :clear-console]
[:app "cmd-shift-s" :save-all]
[:app "cmd-ctrl-f" :window.fullscreen]
[:app "cmd-k" :toggle-console]
[:app "tab" :focus-last-editor]
[:workspace.focused "enter" :lt.plugins.workspace-nav/open-selection]
View styles.less
.theme-atom-visual-studio-code-light-ui {
font-family: 'Segoe WPC', 'Segoe UI', SFUIText-Light, HelveticaNeue-Light, sans-serif, 'Droid Sans Fallback';
atom-pane-container atom-pane {
padding: 0;
.item-views {
border: 0;
border-top: 2px solid #007ACC;
}
View iron-autogrowing-textarea.css
.host {
display: inline-block;
position: relative;
width: 400px;
border: 1px solid;
padding: 2px;
-moz-appearance: textarea;
-webkit-appearance: textarea;
}
.host .mirrorText {