Skip to content

Instantly share code, notes, and snippets.

View ngw's full-sized avatar

Nicholas Wieland ngw

View GitHub Profile

Keybase proof

I hereby claim:

  • I am ngw on github.
  • I am ngw (https://keybase.io/ngw) on keybase.
  • I have a public key ASB87J5ObPsP1_5nFwCWSWzn9owO9fKWIDn_ZKFR1Kv4pAo

To claim this, I am signing this object:

# Welcome to Serverless!
#
# This file is the main config file for your service.
# It's very minimal at this point and uses default values.
# You can always add more config options for more control.
# We've included some commented out config examples here.
# Just uncomment any of them to get that config option.
#
# For full config options, check the docs:
# docs.serverless.com
update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
case Debug.log "msg" msg of
SetPassword password ->
( { model |
user = updatePassword (updatePasswordValue model.user.password password) model.user }
, Cmd.none )
ShowPassword ->
( { model |
user = updatePassword (toggleVisible model.user.password) model.user }
GEM
remote: https://rubygems.org/
specs:
actioncable (5.2.1)
actionpack (= 5.2.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.1)
actionpack (= 5.2.1)
actionview (= 5.2.1)
ngw@bluemonday ~ rails new myapp --webpack=elm
create
create README.md
create Rakefile
create .ruby-version
create config.ru
create .gitignore
create Gemfile
run git init from "."
Initialized empty Git repository in /Users/ngw/myapp/.git/
@ngw
ngw / graphql.elm
Last active August 23, 2018 13:35
userByEmail : UserByEmailRequiredArguments -> SelectionSet decodesTo Schema.Object.User -> Field (Maybe decodesTo) RootQuery
userByEmail requiredArgs object =
Object.selectionField "userByEmail" [ Argument.required "email" requiredArgs.email Encode.string ] object (identity >> Decode.nullable)
type alias EmailQueryResponse =
{ email : Maybe Email }
type alias Email =
{ email: String }
class GraphqlController < ApplicationController
def execute
variables = ensure_hash(params[:variables])
query = params[:query]
operation_name = params[:operationName]
context = {
# Query context goes here, for example:
# current_user: current_user,
}
result = DirectorySchema.execute(query, variables: variables, context: context, operation_name: operation_name)
defmodule Hedging.Mixfile do
use Mix.Project
def project do
[app: :hedging,
version: "0.0.2",
elixir: "~> 1.3",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix, :gettext] ++ Mix.compilers,
build_embedded: Mix.env == :prod,
test "can put and pull several Parker.Element(s) with a priority" do
queue = PriorityQueue.new
element1 = %Element{uid: 'test1', priority: 10}
element2 = %Element{uid: 'test2', priority: 11}
element3 = %Element{uid: 'test3', priority: 9}
queue = PriorityQueue.put(queue, element1)
queue = PriorityQueue.put(queue, element2)
queue = PriorityQueue.put(queue, element3)
{queue, element3_out} = PriorityQueue.pull(queue)
{queue, element2_out} = PriorityQueue.pull(queue)
### Keybase proof
I hereby claim:
* I am ngw on github.
* I am ngw (https://keybase.io/ngw) on keybase.
* I have a public key whose fingerprint is C818 7AB9 2940 B12E 5B38 E9F4 4582 E7E7 E876 E0EE
To claim this, I am signing this object: