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
require 'rubygems' | |
require 'faker' | |
def fake_using(hex_str) | |
prev_random = Faker::Config.random | |
Faker::Config.random = Random.new(hex_str.to_i(16)) | |
result = yield | |
Faker::Config.random = prev_random | |
result | |
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
tables: | |
- path: users | |
fields: | |
- name: name | |
in_place: false | |
cast_type: utf8-str | |
mode: encrypted-duplicate | |
indexes: | |
- version: 1 | |
kind: match |
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
import { HasID, QueryResult, Stash } from "@cipherstash/stashjs" | |
import { movieSchema, Movie } from "./example-schema"; | |
function displayResults(result: QueryResult<Movie & HasID>, name: string) { | |
result.documents.forEach((movie: Movie) => { | |
console.log(movie) | |
}) | |
// TODO: print count | |
console.log("--------------------------------------------------") | |
console.log(name) |
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
CREATE TYPE ore_block_64_8; | |
CREATE FUNCTION ore_block_in_64_8(cstring) | |
RETURNS ore_block_64_8 | |
AS '$libdir/pgsecret' | |
LANGUAGE C IMMUTABLE STRICT; | |
CREATE FUNCTION ore_block_out_64_8(ore_block_64_8) | |
RETURNS cstring | |
AS '$libdir/pgsecret' |
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
["Crocodile", "Giraffe", "Lion", "Tiger"] | |
|> Enum.map(&String.capitalize/1) | |
|> Enum.sort |
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
["Crocodile", "Giraffe", "Lion", "Tiger"].map { |word| | |
word.capitalize | |
}.sort |
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
def print_name(%User{firstname: fname, lastname: lname}) do | |
"#{fname} #{lname}" | |
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
def print_name(%User{} = user) do | |
"#{user.firstname} #{user.lastname}" | |
end | |
def print_name(_) do | |
"Unknown" | |
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
def print_name(user) | |
if user.present? and user.kind_of?(User) | |
"#{user.firstname} #{user.lastname}" | |
else | |
"Unknown" | |
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
import Absinthe.Resolution.Helpers | |
connection field :contracts, node_type: :contract do | |
resolve fn %{id: project_id}, args, %{context: %{current_user: current_user}, dataloader: loader} -> | |
loader | |
|> Dataloader.load_many(Engagement, :contract_ids_for_project_id, project_id) | |
|> on_load(fn loader -> | |
{ | |
:ok, | |
Connection.from_list( |
NewerOlder