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
| require "importmap/npm" | |
| require "importmap/packager" | |
| namespace :importmap do | |
| desc "Download" | |
| task :download do | |
| npm = Importmap::Npm.new | |
| packager = Importmap::Packager.new | |
| packages = npm.packages_with_versions.map { |item| item.join("@") } | |
| imports = packager.import(packages) |
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
| require "net/http" | |
| require "json" | |
| # client = Graphql::Client.new("http://localhost:3000/graphql", { "Authorization" => "Bearer token..." }) | |
| # response = client.execute("query { ... }", { name: "value" }) | |
| class Graphql::Client | |
| def initialize(endpoint, headers = {}) | |
| @endpoint = endpoint | |
| @headers = headers | |
| end |
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: '3.4' | |
| services: | |
| web: | |
| build: . | |
| command: bin/rails server -b 0.0.0.0 | |
| volumes: | |
| - .:/rails | |
| ports: | |
| - 3000:3000 |
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
| 测试 | |
| test |
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
| export GEM_HOME="$(ruby -rubygems -e 'puts Gem.user_dir')" | |
| PATH="$(ruby -rubygems -e 'puts Gem.user_dir')/bin:$PATH" |
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
| unless File.exist?('Gemfile') | |
| File.write('Gemfile', <<-GEMFILE) | |
| source 'https://rubygems.org' | |
| gem 'rails', github: 'rails/rails' | |
| gem 'arel', github: 'rails/arel' | |
| gem 'sqlite3' | |
| GEMFILE | |
| system 'bundle' | |
| end |
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
| #!/bin/bash | |
| USER=deploy | |
| KEYS_PATH=https://github.com/chloerei.keys | |
| useradd -s /bin/bash -m deploy | |
| passwd $USER | |
| adduser $USER sudo | |
| mkdir /home/$USER/.ssh | |
| wget $KEYS_PATH -O /home/$USER/.ssh/authorized_keys |
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
| # = Usage | |
| # Download to your jekyll site directory, and run it | |
| # `ruby jekyll_image_fetcher.rb` | |
| Dir['_posts/*.md'].each do |path| | |
| content = File.open(path).read | |
| basename = File.basename path, '.md' | |
| content.gsub!(/!\[\]\((.+)\)/) do |m| | |
| url = $1 |