Skip to content

Instantly share code, notes, and snippets.

Nicholas Wieland ngw

Block or report user

Report or block ngw

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

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:

View gist:1c75c167cf06b193ca8911b156802b8e
# 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
View State.elm
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 }
View Gemfile.lock
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)
View elm.sh
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/
View graphql.elm
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 }
View grapql.rb
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)
View mix.exs
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,
View test.ex
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)
View gist:a1bd89c05358260597c1cbca426ea881
### 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:
You can’t perform that action at this time.