This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EventHook(object): | |
def __init__(self): | |
self.__handlers = [] | |
def addHandler(self, handler): | |
self.__handlers.append(handler) | |
def removeHandler(self, handler): | |
self.__handlers.remove(handler) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Blog do | |
def fetch(limit, offset \\ 0) do | |
IO.inspect(limit: limit, offset: offset) | |
posts = 1..1000 |> Enum.map(fn i -> %{body: "body #{i}"} end) | |
%{ | |
total_count: length(posts), | |
posts: posts |> Enum.slice(offset || 0, limit) | |
} | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query { | |
user(id: "12345") { | |
id | |
} | |
viewer { | |
user { | |
id | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object :user do | |
field :id, non_null(:id) | |
end | |
object :group do | |
field :id, non_null(:id) | |
field :members, list_of(:user) | |
end | |
query do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Schema do | |
use Absinthe.Schema | |
object :user do | |
field :id, non_null(:id) | |
end | |
object :viewer do | |
field :user, non_null(:user) do | |
resolve(fn _parent, _args, _ctx -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule NhlGraphApi.NhlApi do | |
def data() do | |
Dataloader.KV.new(&fetch/2) | |
end | |
def fetch(_batch_key, arg_maps) do | |
IO.inspect(arg_maps: arg_maps) | |
%{%{id: "1"} => %{id: 1, name: "foo", city: "bar", abbreviation: "OMG"}} | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ApiWeb.Schema do | |
use Absinthe.Schema | |
import Absinthe.Resolution.Helpers | |
import_types Absinthe.Type.Custom | |
@desc "A user" | |
object :user do | |
field :id, non_null(:string) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.reststopperpro.android.activity; | |
import android.Manifest; | |
import android.content.pm.PackageManager; | |
import android.os.Bundle; | |
import android.support.annotation.NonNull; | |
import android.support.annotation.Nullable; | |
import android.support.v4.app.ActivityCompat; | |
import android.support.v7.app.AppCompatActivity; | |
import android.view.View; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mygdx.game.screen; | |
import com.badlogic.gdx.Gdx; | |
import com.badlogic.gdx.InputMultiplexer; | |
import com.badlogic.gdx.InputProcessor; | |
import com.badlogic.gdx.Screen; | |
import com.badlogic.gdx.graphics.GL20; | |
import com.badlogic.gdx.scenes.scene2d.Stage; | |
import com.badlogic.gdx.utils.viewport.FitViewport; | |
import com.badlogic.gdx.utils.viewport.Viewport; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
call pathogen#infect() | |
set nocompatible | |
set autoindent | |
set modelines=5 | |
syntax on | |
filetype plugin indent on | |
set background=dark | |
set number | |
set tabstop=2 | |
set shiftwidth=2 |
NewerOlder