Skip to content

Instantly share code, notes, and snippets.

View dfcarpenter's full-sized avatar

Daniel Carpenter dfcarpenter

View GitHub Profile

Keybase proof

I hereby claim:

  • I am dfcarpenter on github.
  • I am dfcarpenter (https://keybase.io/dfcarpenter) on keybase.
  • I have a public key whose fingerprint is A9C3 98C2 D527 1565 5775 14E7 E9B7 4BED 1F3C 02CF

To claim this, I am signing this object:

@dfcarpenter
dfcarpenter / shouter.handler.cljs
Last active September 2, 2015 19:32
Re-frame / cljs-http problem
(ns shouter.handlers
(:require-macros [cljs.core.async.macros :refer [go]])
(:require [re-frame.core :as re-frame]
[shouter.db :as db]
[reagent.session :as session]
[cljs-http.client :as http]
[cljs.core.async :refer [<! >! chan put!]]))
(re-frame/register-handler
:initialize-db
@dfcarpenter
dfcarpenter / decode.ex
Created September 25, 2015 20:12
decoding
iex(1)> decode = "bm9uY2U9Y2JlYTQ1NGQyYjNiYmQyZTI1OTQ2YzNkYT\nViOTM5OWYmcmV0dXJu\nX3Nzb191cmw9aHR0cCUzQSUyRiUyRmZvcnVtcy5zdHJpbmdpZnkuY29tJTJG\nc2Vzc2lvbiUyRnNzb19sb2dpbg==\n"
"bm9uY2U9Y2JlYTQ1NGQyYjNiYmQyZTI1OTQ2YzNkYT\nViOTM5OWYmcmV0dXJu\nX3Nzb191cmw9aHR0cCUzQSUyRiUyRmZvcnVtcy5zdHJpbmdpZnkuY29tJTJG\nc2Vzc2lvbiUyRnNzb19sb2dpbg==\n"
iex(2)> Base.decode64! decode
** (ArgumentError) non-alphabet digit found:
(elixir) lib/base.ex:111: Base.dec64/1
(elixir) lib/base.ex:518: Base."-do_decode64/2-lbc$^0/2-0-"/3
(elixir) lib/base.ex:518: Base.do_decode64/2
iex(2)> Base.url_decode64! decode
** (ArgumentError) non-alphabet digit found:
<?php
/*
Template Name: Experiences List
*/
get_header();
?>
<div id="primary" class="content-area">
<main id="main" role="main">
<div class="experiences">
@dfcarpenter
dfcarpenter / test.ex
Last active January 15, 2016 21:13
Elixir service
Users.newusers
|> elem(1)
|> Map.get("Items")
|> Poison.encode
|> elem(1)
|> File.write("/dir/users.json")
#response from dynamodb after first function
@dfcarpenter
dfcarpenter / README
Created January 21, 2016 22:20 — forked from mremond/README
Phoenix Elixir framework with ejabberd - Tutorial
Please read original blog post for reference:
http://blog.process-one.net/embedding-ejabberd-into-an-elixir-phoenix-web-application/
@dfcarpenter
dfcarpenter / main.elm
Last active March 30, 2016 19:19
Github users
module Main (..) where
import Effects exposing (Effects, Never)
import Html exposing (..)
import Html.Attributes exposing (style)
import Html.Events exposing (onClick)
import Http
import Json.Decode as Decode exposing ((:=))
import Json.Decode.Extra exposing ((|:))
import Task
// Mutex implementation originally taken from https://github.com/mgtitimoli/await-mutex
/* Why do you need mutexes in a single threaded context ?
* Presumably instances of `MyObject` can be accessed by functions which are running while this function is suspended,
* waiting for the network call. It's single threaded, as in only one thing happens at a time from JS's point of view,
* but other functions can be invoked (by a request coming in, or a UI event etc) while an asynchronous operation
* is awaiting completion.
*/
@dfcarpenter
dfcarpenter / wizard.cljs
Created October 1, 2017 23:39
converting some JS
getNavStates(indx, length) {
let styles = [];
for (let i=0; i<length; i++) {
if (i < indx) {
styles.push('done');
}
else if (i === indx) {
styles.push('doing');
}
@dfcarpenter
dfcarpenter / wagtail.Dockerfile
Created January 25, 2018 22:29
wagtail multistage build dockerfile
FROM python:3.6
COPY requirements.txt .
COPY package.json .
WORKDIR /app/
ADD . /app/
RUN set -ex \
&& apt-get update \