Based on this blogpost.
Install with Homebrew:
$ brew install postgresqlRun server:
Based on this blogpost.
Install with Homebrew:
$ brew install postgresqlRun server:
This example demonstrates how we can cache the response fragments in graphql-ruby.
Existing solutions only allow caching resolved values but not all the GraphQL machinery (validation, coercion, whatever).
Caching response parts (in case of Ruby, sub-Hashes) is much more efficient.
First we'll update your local master branch. Go to your local project and check out the branch you want to merge into (your local master branch)
$ git checkout masterFetch the remote, bringing the branches and their commits from the remote repository. You can use the -p, --prune option to delete any remote-tracking references that no longer exist in the remote. Commits to master will be stored in a local branch, remotes/origin/master
| require 'openssl' | |
| class String | |
| def encrypt(key) | |
| cipher = OpenSSL::Cipher.new('DES-EDE3-CBC').encrypt | |
| cipher.key = Digest::SHA1.hexdigest key | |
| s = cipher.update(self) + cipher.final | |
| s.unpack('H*')[0].upcase | |
| end |
| # Ruby opposite of array intersection... or maybe the method is missing from my brain bc not enough coffee | |
| # http://twitter.com/soawesomeman/status/8035087261 | |
| def awesome(ar_1, ar_2) | |
| (ar_1 + ar_2) - (ar_1 & ar_2) | |
| end | |
| awesome([1,2,3,4], [3,4,5,6]) # => [1, 2, 5, 6] | |
| defp upsert_profile(multi, source, source_uuid, profile_url) do | |
| profile = %Profile{ | |
| source: source, | |
| source_uuid: source_uuid, | |
| profile: profile_url, | |
| } | |
| Ecto.Multi.insert(multi, source_uuid, profile, on_conflict: [set: [profile: profile_url]], conflict_target: [:source, :source_uuid]) | |
| end |
| defmodule Util do | |
| defmacro __using__(_) do | |
| quote do | |
| require Util | |
| # Should it be imported? | |
| # import Util | |
| end | |
| end | |
| defmacro blank?(x) when is_binary(x) do |
Example inputs:
| Variable | Value |
|---|---|
| key | the shared secret key here |
| message | the message to hash here |
Reference outputs for example inputs above:
| Type | Hash |
| #!/usr/bin/env ruby | |
| # Evaluates a sample of keys/values from each redis database, computing statistics for each key pattern: | |
| # keys: number of keys matching the given pattern | |
| # size: approximation of the associated memory occupied (based on size/length of value) | |
| # percent: the proportion of this 'size' relative to the sample's total | |
| # | |
| # Copyright Weplay, Inc. 2010. Available for use under the MIT license. | |