Skip to content

Instantly share code, notes, and snippets.

View thejohnnybot's full-sized avatar

Johnny Mejias thejohnnybot

  • North Bergen, NJ
View GitHub Profile
@thejohnnybot
thejohnnybot / transaction.ex
Created January 1, 2024 00:02
ash resource
defmodule ExPay.Payment.Transaction do
use Ash.Resource,
data_layer: AshPostgres.DataLayer,
extensions: [AshJsonApi.Resource]
json_api do
type "transactions"
routes do
base "/transactions"
{
"campaign": {
"name": "May Newsletter",
"templateSettings": {
"context": {
"context": {
"rid": "%%emailaddr%%",
"custom": {
"header": "",
"footer": "",
@thejohnnybot
thejohnnybot / rmcc.md
Created September 20, 2017 15:48 — forked from devinus/rmcc.md
Rebelmail Code Challenge

Rebelmail Code Challenge

Minimize an HTML page with inline CSS using whatever novel techniques you can think of without affecting the presentation of the document.

Write a microservice to consume the HTML, save an email document to a database with the original and transformed versions of the document, and send the transformed result in an HTML email to a specified recipient.

@thejohnnybot
thejohnnybot / checkout.js
Created September 11, 2017 14:42
Example moongoose model
const mongoose = require('mongoose');
const { decrypt, encrypt } = require('../utils/crypto');
const { Schema } = mongoose;
const CheckoutSchema = mongoose.Schema({
userId: Schema.Types.ObjectId,
customerId: Schema.Types.ObjectId,
status: { type: String, enum: ['queued', 'sent', 'recovered'] },
provider: String,
selector iframe value result
#some #iframe black black
#some #iframe yellow yellow
#some #iframe red red
#some #iframe violet violet
#some #iframe green green
import { extendObservable } from 'mobx';
import { setDefaultModelSchema, list, object, primitive } from 'serializr';
import { defaults } from 'lodash';
import Address from './Address';
import Customer from './Customer';
import Order from './Order';
class Checkout {
constructor(obj) {
const checkout = defaults({
@thejohnnybot
thejohnnybot / core.clj
Created January 13, 2016 15:01
clara issue
(ns ruler.core
(:gen-class)
(:require [clara.rules :refer :all]
[clara.tools.inspect :refer :all]))
(defrecord Person [name age])
(defrule is-adult
[Person (>= 21 age)]
=>
FROM msaraiva/elixir-dev
RUN apk --update add make gcc bash vim git-bash-completion && \
rm -rf /var/cache/apk/*
COPY . /usr/src/app
WORKDIR /usr/src/app
RUN mix do deps.get, compile
== Compilation error on file lib/comeonin/bcrypt.ex ==
** (MatchError) no match of right hand side value: {:error, :on_load_failure}
(stdlib) erl_eval.erl:669: :erl_eval.do_apply/6
17:04:22.407 [error] Process #PID<0.131.0> raised an exception
** (MatchError) no match of right hand side value: {:error, {:load_failed, 'Failed to load NIF library: \'Error loading shared library /usr/src/app/_build/dev/lib/comeonin/priv/bcrypt_nif.so: Exec format error\''}}
lib/comeonin/bcrypt.ex:45: Comeonin.Bcrypt.init/0
(kernel) code_server.erl:1674: anonymous fn/1 in :code_server.handle_on_load/4
could not compile dependency :comeonin, "mix compile" failed. You can recompile this dependency with "mix deps.compile comeonin", update it with "mix deps.update comeonin" or clean it with "mix deps.clean comeonin"
FROM ubuntu:14.04
MAINTAINER Johnny Mejias <[email protected]>
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update -q && \
apt-get -y install curl locales && \
locale-gen "en_US.UTF-8" && \
export LANG=en_US.UTF-8 && \
curl -o /tmp/erlang.deb http://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb && \