Some notes on AI/ML tools that seem interesting/useful (largely aiming to focus on open source tools)
<?php | |
namespace App\GraphQL\Directives; | |
use Error; | |
use GraphQL\Language\AST\FieldDefinitionNode; | |
use GraphQL\Language\AST\InterfaceTypeDefinitionNode; | |
use GraphQL\Language\AST\NonNullTypeNode; | |
use GraphQL\Language\AST\ObjectTypeDefinitionNode; | |
use GraphQL\Language\Parser; |
The package that linked you here is now pure ESM. It cannot be require()
'd from CommonJS.
This means you have the following choices:
- Use ESM yourself. (preferred)
Useimport foo from 'foo'
instead ofconst foo = require('foo')
to import the package. You also need to put"type": "module"
in your package.json and more. Follow the below guide. - If the package is used in an async context, you could use
await import(…)
from CommonJS instead ofrequire(…)
. - Stay on the existing version of the package until you can move to ESM.
This is a slightly cleaned-up version of the venting I did while pulling my hair out over react-native issues. The state of using react-native might be getting better with the community restructuring and core-rewrite. So take these dated notes with a grain of salt.
After months of struggling to port libraries and develop applications using react-native, I have to recommend trading the comfort and breadth of the react and javascript ecosystems for Flutter and dart if you're developing a mobile app.
react-native is buggy and slow (or at least very hard to make fast). Perhaps it can be blamed on the size of the community, but the project is managed in an almost adversarial style. Almost all issues are ignored until the bot closes them for being "stale". They get locked too, just to make sure the community can't communicate work
import React from 'react'; | |
import PropTypes from 'prop-types'; | |
import SyntaxHighlighter from 'react-syntax-highlighter'; | |
export default class CodeBlock extends React.PureComponent { | |
static propTypes = { | |
value: PropTypes.string.isRequired, | |
language: PropTypes.string, | |
} |
{ | |
"scripts": { | |
"postdeploy": "pg_dump -Fc $DATABASE_URL_TO_COPY | pg_restore --clean --no-owner -n public -d $DATABASE_URL && bundle exec rails db:migrate" | |
} | |
} |
# frozen_string_literal: true | |
class AssociationLoader < GraphQL::Batch::Loader | |
attr_reader :klass, :association | |
def initialize(klass, association) | |
raise ArgumentError, "association to load must be a symbol (got #{association.inspect})" unless association.is_a?(Symbol) | |
raise ArgumentError, "cannot load associations for class #{klass.name}" unless klass < ActiveRecord::Base | |
raise TypeError, "association #{association} does not exist on #{klass.name}" unless klass.reflect_on_association(association) | |
@klass = klass |
source 'https://rubygems.org' | |
gem "graphql", github: "rmosolgo/graphql-ruby", branch: "subscriptions" | |
gem "sinatra" | |
gem "thin" |
require 'rom-repository' | |
require 'rom-sql' | |
require 'logger' | |
config = ROM::Configuration.new(:sql, 'sqlite::memory') | |
config.gateways[:default].connection.create_table(:songs) do | |
primary_key :id | |
column :title, String | |
end |
#!/usr/bin/env ruby | |
require 'bundler/inline' | |
require 'json' | |
gemfile(:install) do | |
gem 'rom', '>= 2.0', github: 'rom-rb/rom', branch: 'master' | |
gem 'rom-http', github: 'rom-http-rb/rom-http', branch: 'master' | |
gem 'faraday' | |
end |