This file contains hidden or 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
consult https://blog.appsignal.com/2022/08/03/connect-a-ruby-on-rails-app-with-react-in-a-monolith.html | |
rails new <app name> -d <database> -j esbuild | |
cd into app | |
./bin/rails db:create | |
./bin/rails s | |
generate a home controller -> ./bin/rails g controller Home index | |
update routes to make home#index the root | |
yarn add react react-dom node-uuid | |
update the build portion of packages.json to be: |
This file contains hidden or 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
Printer | |
X Width 235 | |
Y Width 235 | |
Z Height 285 | |
origin at center NOT checked | |
Heated bed checked | |
Head build volume NOT checked |
This file contains hidden or 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
# Small helper script for weeding out bad images before stacking astroimages | |
# Requires DS9 fits viewer https://sites.google.com/cfa.harvard.edu/saoimageds9 | |
# Meant to be run in the directory with your fits files | |
mkdir -p bad | |
for f in *.fit[s] | |
do | |
echo "Opening $f" | |
ds9 $f |
This file contains hidden or 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 python3 | |
# install imagesize: pip install imagesize | |
# Modifications by David Moulton | |
# See this page: https://github.com/opieters/jekyll-image-gallery-example | |
__author__ = 'Olivier Pieters' | |
__author_email__ = '[email protected]' | |
__license__ = 'BSD-3-Clause' |
This file contains hidden or 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
[error] GenServer #PID<0.2560.0> terminating | |
** (RuntimeError) cannot encode association :user from Discuss.Comment to JSON because the association was not loaded. Please make sure you have preloaded the association or remove it from the data to be encoded | |
(ecto) lib/ecto/poison.ex:12: Poison.Encoder.Ecto.Association.NotLoaded.encode/2 | |
(poison) lib/poison/encoder.ex:213: anonymous fn/4 in Poison.Encoder.Map.encode/3 | |
(poison) lib/poison/encoder.ex:214: Poison.Encoder.Map."-encode/3-lists^foldl/2-0-"/3 | |
(poison) lib/poison/encoder.ex:214: Poison.Encoder.Map.encode/3 | |
(poison) lib/poison/encoder.ex:213: anonymous fn/4 in Poison.Encoder.Map.encode/3 | |
(poison) lib/poison/encoder.ex:214: Poison.Encoder.Map."-encode/3-lists^foldl/2-0-"/3 | |
(poison) lib/poison/encoder.ex:214: Poison.Encoder.Map.encode/3 | |
(poison) lib/poison/encoder.ex:213: anonymous fn/4 in Poison.Encoder.Map.encode/3 |
This file contains hidden or 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
Using jruby 1.7.0preview2 I try to use IMGKit to create a file, I get: | |
╰─$ rails c | |
Loading development environment (Rails 3.2.3) | |
[1] pry(main)> kit = IMGKit.new("hello") | |
#<IMGKit:0x0000683c | |
attr_accessor :source = #<IMGKit::Source:0x00006840 | |
@source = "hello" | |
>, | |
attr_accessor :stylesheets = [], |
This file contains hidden or 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
## Hstore Method Missing Extension | |
module HstoreModel | |
def method_missing(method, *args, &block) | |
key = method.to_s.gsub('=','').to_sym | |
sym_options = options.symbolize_keys | |
if !self.class.attribute_methods_generated? | |
self.class.define_attribute_methods | |
if respond_to_without_attributes?(method) | |
send(method, *args, &block) |
This file contains hidden or 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
# Should probably go in application_helper | |
# examples (when run in this order): | |
# autotab # returns 1 | |
# autotab # returns 2 | |
# autotab(100) # returns 102 | |
# autotab # returns 3 | |
# autotab(100,true) # returns 104 | |
# autotab # returns 105 | |
# example f.text_field :address, :tabindex=>autotab |
This file contains hidden or 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
version 2.0 | |
config setup | |
nat_traversal=yes | |
virtual_private=%v4:10.0.0.0/8,%v4:192.168.0.0/16,%v4:172.16.0.0/12 | |
oe=off | |
protostack=netkey | |
conn L2TP-PSK-NAT | |
rightsubnet=vhost:%priv | |
also=L2TP-PSK-noNAT |
NewerOlder