So I built a dummy Rails-plugin gem...
rails plugin new foo --skip-bundle -O --full
and filled in my .gemspec
as below, including the line
s.add_dependency "rails-assets-sugar"
and added
module Base64ToFile | |
extend ActiveSupport::Concern | |
def base64_to_file(base64_data, filename=nil) | |
return base64_data unless base64_data.is_a? String | |
start_regex = /data:image\/[a-z]{3,4};base64,/ | |
filename ||= SecureRandom.hex | |
regex_result = start_regex.match(base64_data) |
❯ ollama run llama3.1 | |
>>> create app-volume pod with container image 'gcr.io/kuar-demo/kuard-amd64:1' named 'app' and open container port 8080 with name 'http' with livenessProbe http get at port 8080 with settin | |
... gs: initial delay seconds 5, timeout seconds 1, period seconds 10, failure threshold 3 and readinessProbe at path /ready port 8080 with settings: period seconds 2, initial delay seconds | |
... 0, failure threshold 3, success threshold 1. Add volume mount named 'data' at host path /var/lib/app to mounted at /data | |
Here is the YAML configuration for a Kubernetes Pod that meets your requirements: | |
``` | |
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: app-volume |
ollama run llama3 | |
>>> create app pod labeled 'app=demo, run=demo' with container image 'gcr.io/k8s-k3s/demo:v1.0.0' named 'app' and open container port 8000 with name 'http' | |
Here is the YAML file to create an App of Pod labeled 'app=demo, run=demo' with a container image 'gcr.io/k8s-k3s/demo:v1.0.0', named 'app', and opening container port 8000 with name | |
'http': | |
```yaml | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
labels: | |
app: demo |
http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query | |
http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails | |
#payload: [{"kind"=>"person"}] | |
Segment.where("payload @> ?", [{kind: "person"}].to_json) | |
#data: {"interest"=>["music", "movies", "programming"]} | |
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json) | |
Segment.where("data #>> '{interest, 1}' = 'movies' ") | |
Segment.where("jsonb_array_length(data->'interest') > 1") |
# This is the ONLY way I've found that works | |
# All other suggested solutions (see below examples) don't actually work | |
# And as an extra bonus: this deep copies as well! | |
def deep_copy(o) | |
Marshal.load(Marshal.dump(o)) | |
end |
So I built a dummy Rails-plugin gem...
rails plugin new foo --skip-bundle -O --full
and filled in my .gemspec
as below, including the line
s.add_dependency "rails-assets-sugar"
and added
require "mkmf" | |
ext_name = 'my_extension' | |
excluded = ['x86', 'x64'] | |
dir_config(ext_name) | |
$srcs = Dir.glob("#{$srcdir}/**/*.c").map { |path| File.basename(path) } | |
Dir.glob("#{$srcdir}/*/") do |path| | |
dir = File.basename(path) |
One way to do this is to use bundler to scaffold our gem:
bundler gem my_gem
I prefer to put tasks meant to manage the gem itself in lib/tasks
, and tasks the gem is meant to provide to gem users in lib/my_gem/tasks
.
rails new <project_name> -d postgresql --skip-turbolinks --skip-spring -T
-d postgresql
sets up the project to use PostgreSQL--skip-turbolinks
& --skip-spring
creates a project that does not use turbolinks or spring-T
skips the creation of the test directory and use of Test::Unit
# /*---------------------------------------------- | |
# Author: SDK Support Group | |
# Company: Paya | |
# Contact: [email protected] | |
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
# !!! Samples intended for educational use only!!! | |
# !!! Not intended for production !!! | |
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
# -----------------------------------------------*/ |