Skip to content

Instantly share code, notes, and snippets.

View napcs's full-sized avatar

Brian P. Hogan napcs

View GitHub Profile
@napcs
napcs / pizza_party.elm
Last active June 17, 2016 19:22
EFP #8
import Html.App exposing (beginnerProgram)
import Html exposing(Html, Attribute, button, div, text, span, label, input, p)
import Html.Attributes exposing(value, style, placeholder)
import Html.Events exposing(onClick, onInput)
import String exposing(toFloat)
main =
beginnerProgram {model = model, view = view, update = update}
@napcs
napcs / astros.json
Created March 22, 2016 04:17
EFP 47
{
"message": "success",
"number": 6,
"people": [
{
"craft": "ISS",
"name": "Yuri Malenchenko"
},
{
"craft": "ISS",
@napcs
napcs / 01_hello.elm
Created December 31, 2015 01:29
EFP #1 in Elm
-- Exercises For Programmers #1
import Html exposing (Html, text, div, p, input, label)
import Html.Attributes exposing (id, value, for)
import Html.Events exposing(on, targetValue)
import StartApp.Simple as StartApp
import Signal exposing (Address)
type Action
@napcs
napcs / compound_interest.elm
Created December 16, 2015 04:38
Exercises For Programmers #13 in Elm.
import Html exposing (Html, text, div, p, button, input, label, span)
import Html.Attributes exposing (..)
import Html.Events exposing (onClick, on, targetValue)
import Signal exposing (Address)
import StartApp.Simple as StartApp
import String exposing (..)
type alias Model =
{
principle: String,
module PaintCalculator where
import Html exposing (..)
import Html.Attributes exposing(..)
import Html.Events exposing(..)
import String exposing (..)
import Signal exposing (Address)
import StartApp.Simple as StartApp
@napcs
napcs / counter.elm
Last active November 19, 2015 16:04
module CharacterCounter where
import Html exposing(..)
import Html.Attributes exposing(..)
import Html.Events exposing(..)
import String exposing(..)
import Signal exposing (Address)
import StartApp.Simple as StartApp

Some things I have encountered when working with Ecto in Phoenix projects.

This may sound like a lot of complaining, but I am listing things I keep running into that, on their own, don't amount to much, but together, frustrate me.

This may also expose things that I don't understand about Ecto and FP. And I ask that instead of telling me I'm wrong, you consider why I may have come to these conclusions. There's a chance others will as well.

Ultimately, the choice of how Ecto works is up to those that maintain it. Software is full of opinions. But here are the main things that keep coming up for me. And in my opinion, I find them uncomfortable.

  1. It's included by default now.
  • When I generate a new project, Ecto is included in my mix.exs file and is brought in as a dependency. A default repository is created and configured to use PG. I understand that there's a way to opt out, but running mix phoenix.new with no arguments does not indicate how. (it's --no-ecto.)
@napcs
napcs / README.md
Created September 9, 2015 14:09
Learning Preferences App

I'm looking for your help to help me understand React better.

I have an idea for a simple app. It’s based on an educational activity I did in a training session once, and I think it’s a good opportunity for me to learn React.

Here’s the premise. You’re given a shuffled deck of cards. Each card has a type of activity on the card and is a certain color based on the type of learning preference it targets. For example one card may say “You use music during breaks”. You go through the card and place all the ones you actively do in your classroom into one pile, and place the ones you don’t in the discard pile. At the end of the activity, you have a clearer picture of what learning preferences you target, and what preferences you don’t. And you get ideas for activities to do in the classroom.

I thought making a digital version of this would work well. The app would present each card to you and ask you if you do that activity. When you’re all done, the cards would be displayed in both piles.

Here’s where I n

@napcs
napcs / JS Loading in web frameworks like Elixir
Last active January 20, 2020 04:05
Per-view JavaScript functions for Phoenix. Keeps things out of global space, allows a page to specifically invoke the JS it needs.
How to load page-specific JS functions and pass values to those functions when JS is loaded below your views.
@napcs
napcs / README.md
Created January 9, 2015 19:42
DigitalOcean Setup

Quickly build a DigitalOcean box

You can use Chef or Puppet to build out your infrastructure, but if you just need a quick and dirty box set up,

Installation

First, download Vagrant and install it.

After that, visit your DigitalOcean account and obtain your API key.