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 "graphql" | |
require 'graphql/client' | |
require 'ostruct' | |
module Resolver | |
module_function | |
def resolve_type(obj, ctx) | |
puts "resoleving type: #{obj.class.name}" | |
puts "obj: #{obj}" |
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 'dry/schema' | |
require 'json' | |
Dry::Schema.load_extensions(:json_schema) | |
GetWeatherSchema = Dry::Schema.JSON do | |
required(:location).filled(:string) | |
optional(:unit).filled(:string, included_in?: %w[celsius fahrenheit]) | |
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
# gem "ruby-openai", "~> 4.1" | |
# https://openai.com/blog/function-calling-and-other-api-updates | |
require 'openai' | |
require 'json' | |
require 'dotenv' | |
Dotenv.load("../.env") | |
ACCESS_TOKEN = ENV["OPENAI_API_KEY"] |
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 Cocoa | |
import SwiftUI | |
import Combine | |
class AppState: ObservableObject { | |
@Published var isRescaling = false | |
@Published var scaleCurrent: CGFloat = 1.0 | |
@Published var scaleFinal: CGFloat = 1.0 | |
func rescaling(_ enabled: Bool) { |
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
``` | |
## based on: https://docs.python.org/2/extending/embedding.html | |
arek@qyobo:~/workspace/embeding_python$ gcc -I/usr/include/python2.7 -I/usr/include/x86_64-linux-gnu/python2.7 main.c -lpython2.7 -o run-python | |
arek@qyobo:~/workspace/embeding_python$ cat main.c | |
#include "Python.h" | |
int | |
main(int argc, char *argv[]) | |
{ |
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 "json" | |
require "websocket-eventmachine-client" | |
require "securerandom" | |
require 'date' | |
require "base64" | |
API_HOST = "CHANGEME.appsync-api.ap-northeast-1.amazonaws.com" | |
API_KEY = "da2-CHANGEME" | |
REAL_TIME_HOST = API_HOST.gsub("appsync-api","appsync-realtime-api") |
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
#!/usr/bin/env ruby | |
require "aws-sigv4" | |
require "aws-sdk-core" | |
require "active_support/all" | |
require "aws-eventstream" | |
require "excon" | |
BUCKET_NAME = ARGV[0] |
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
#Based off camwest's gist at https://gist.github.com/363958 | |
#Using to_s instead of extending String | |
require 'openssl' | |
require 'cgi' | |
class S3QueryURL | |
def initialize(bucket, path, options = {}) | |
@access_key_id = options[:access_key_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
addProblem: (disease) -> | |
Ordering.MedicalRecord.store.find("medicalRecord",2) | |
.then (mr) => | |
mr.get("problems") | |
.then (problems) => | |
o = @store.createRecord("problem", {disease: disease, medicalRecord: mr}) | |
.then (p) -> | |
p.save().then -> | |
console.log "Problem was saved correctly!" |
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 Assignment | |
constructor: (o) -> | |
$.map o, (v,k) => | |
@name = k | |
@app = v | |
class System | |
constructor: (o) -> | |
@users = $.map o.users, (v,k) => | |
new User(k,v) |
NewerOlder