Skip to content

Instantly share code, notes, and snippets.

View mattly's full-sized avatar
💭
I may be slow to respond.

Matthew Lyon mattly

💭
I may be slow to respond.
View GitHub Profile
Programming for something on the server typically looks like this:
* Something happened that you need to respond to. A request, a queue item, etc.
* You hydrate any state not included in the event from a cache or database or somewhere.
* You do whatever processing you need to do.
* You persist any new state that needs to be persisted
* Maybe you respond to the event if needed, or trigger other side-effects.
This typically happens on a computer you control, with lots of layers of control around making
sure the event is properly-formed and handled in a kind of queue, to make sure you're making the
best use of your resources, and events are coordinated and dispatched properly.
{:paths #{"src" "test"}
:deps
{org.clojure/clojure {:mvn/version "1.9.0"}
org.clojure/clojurescript {:mvn/version "1.10.339"}
binaryage/devtools {:mvn/version "0.9.10"}
refactor-nrepl {:mvn/version "2.4.0"}
cider/cider-nrepl {:mvn/version "0.18.0"}
cider/nrepl {:mvn/version "0.3.0"}}
Swatches
New Document
bang -> Paste Into New Palette
Paste Into New Palette
change text -> Paste Into New Palette
import -> Inspect Palette
Inspect Palette
back -> List Entities
pick swatch -> Inspect Swatch
add swatch -> Seeking Swatch
#!/usr/bin/env ruby
require "rubygems"
require "twitter"
require './mattly'
TWITTER_USER = Mattly.user
client = Mattly.client
following_ids = client.friend_ids(TWITTER_USER).to_a
@mattly
mattly / languages.md
Last active April 2, 2019 22:09 — forked from joshsusser/languages.md
languages I've been paid to program in
  1. AppleScript
  2. bash
  3. Clojure
  4. ClojureScript
  5. CoffeeScript
  6. Datalog
  7. Elixir
  8. Elm
  9. Erlang
  10. Filemaker Pro
@mattly
mattly / theme.coffee
Created April 21, 2018 12:40
atom theme settings example
fs = require 'fs'
{CompositeDisposable} = require 'atom'
class SectorOne
config:
comments:
title: 'Comment brightness'
description: 'Choose between bright dim comments'
type: 'string'
default: 'Bright'
(ns myapp.server.rest
(:require
(myapp.server.graphql :as gql)
(myapp.server.response :as resp)))
(defn- from-body-payload [keys]
(comp ;; comp composes functions, this is equiv. to (fn [x] (-> x :request :json-params :payload (select-keys keys)))
#(select-keys % keys)
:payload ;; keywords in clojure, when used as a function on an associative, will get the value at that keyword
:json-params
@mattly
mattly / transit.clj
Created August 18, 2017 05:29
Quick util for reading/writing transit json in clojure
(ns myapp.util.transit
(:require
[clojure.java.io :as io]
[cognitect.transit :as transit])
(:import
[java.io ByteArrayOutputStream]))
(defn- ->stream [input]
(cond (string? input) (io/input-stream (.getBytes input))
:default input))
// Cascading and Mutability cause pain
// and all sorts of trouble for your brain
// so quit being pedantic
// those styles are gigantic
// and Functional CSS is quite sane
// http://mrmrs.io/writing/2016/03/24/scalable-css/
// https://marcelosomers.com/writing/rationalizing-functional-css/
// https://blog.colepeters.com/building-and-shipping-functional-css/
(defn- state-line [[state results]]
(let [d (->> results
(sort-by :year)
(reduce (fn [line {:keys [year from-center]}]
(conj line (str (x-for-margin from-center)
","
(+ 10 (year-base year)))))
[])
(interpose "L")
(concat ["M"])