Skip to content

Instantly share code, notes, and snippets.

View tonyghita's full-sized avatar

Tony Ghita tonyghita

View GitHub Profile
@tonyghita
tonyghita / .gitconfig
Created August 29, 2014 23:34
Alias for checkout out pull-requests locally
[alias]
co-pr = !sh -c 'git fetch origin pull/$1/head:pr/$1 && git checkout pr/$1' -
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap Masonry Template</title>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans+Caption:400,700">
@tonyghita
tonyghita / prepare-commit-msg
Created June 25, 2012 16:56
git hook which prepends the branch name to the commit message
#!/usr/bin/env ruby
branchname = `git describe --contains --all HEAD`
message_file = ARGV[0]
message = File.read(message_file)
File.open(message_file, 'w') {|f| f.write branchname + message }
if (devMiddleware) {
app.get('*', (req, res) => {
res.write(devMiddleware.fileSystem.readFileSync(path.join(__dirname, '../..', 'build', 'index.html')))
res.end()
})
} else {
app.use(express.static(path.join(__dirname, '../..', 'build')))
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname, '../..', 'build', 'index.html'))
})

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@tonyghita
tonyghita / dataloader_resolver.go
Last active January 29, 2018 06:52
Example integration of graphql-go resolvers and dataloader
type RootResolver struct {
UsersClient users.client
}
type UserResolver struct {
id string // We can forgo a user lookup in the case a field resolvers only needs the user's id (e.g. fetching a user's friends).
load dataloader.Thunk // call this function to load user for field resolution
}
// loadUsers gets passed to the request-specific dataloader as the batch function

Recommended GraphQL talks

This is not an exhaustive list, but should be enough to get you started.

Lee Byron - Exploring GraphQL (2015)

Lee explores GraphQL's core principles, how it works, and what makes it a great tool.

https://www.youtube.com/watch?v=WQLzZf34FJ8