A comparison of nvm and Volta to manage Node.js projects (without Yarn).
nvm install| #!/usr/bin/env bash | |
| # Abort sign off on any error | |
| set -e | |
| # Start the benchmark timer | |
| SECONDS=0 | |
| # Repository introspection | |
| OWNER=$(gh repo view --json owner --jq .owner.login) |
| class Perceptron | |
| def initialize(inputs, bias = 0.0) | |
| @weights = Array.new(inputs.keys.first.size) { rand } | |
| @inputs = inputs | |
| @bias = bias | |
| end | |
| def run(inputs) | |
| z = inputs.zip(@weights).map { |i, w| i * w }.reduce(:+) + @bias | |
| 1.0 / (1.0 + Math.exp(-z)) |
| # Rails production setup via SQLite3 made durable by https://litestream.io/ | |
| # Copy this to Dockerfile on a fresh rails app. Deploy to fly.io or any other container engine. | |
| # | |
| # try locally: docker build . -t rails && docker run -p3000:3000 -it rails | |
| # | |
| # in production you might want to map /data to somewhere on the host, | |
| # but you don't have to! | |
| # | |
| FROM ruby:3.0.2 |
| . | |
| ├── config | |
| │ └── config.go | |
| ├── go.mod | |
| ├── go.sum | |
| ├── main.go | |
| └── models | |
| └── books | |
| └── books.go |
| function CopyButton({ value }) { | |
| let [copied, setCopied] = React.useState(); | |
| let hydrated = usePageIsHydrated(); | |
| React.useEffect(() => { | |
| let id = setTimeout(() => setCopied(false), 2000); | |
| return () => clearTimeout(id); | |
| }, [copied]); | |
| return ( | |
| <button |
| ruby '2.7.1' | |
| gem 'rails', github: 'rails/rails' | |
| gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data | |
| # Action Text | |
| gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra' | |
| gem 'okra', github: 'basecamp/okra' | |
| # Drivers |
| module Entry::TrackerBlocking | |
| extend ActiveSupport::Concern | |
| included do | |
| has_many :blocked_trackers | |
| end | |
| email_service_blockers = { | |
| "ActiveCampaign" => /lt\.php(.*)?l\=open/, | |
| "AWeber" => "openrate.aweber.com", |
| #!/usr/bin/env node | |
| const path = require('path') | |
| const inquirer = require('inquirer') | |
| const replace = require('replace-in-file') | |
| const isCI = require('is-ci') | |
| const spawn = require('cross-spawn') | |
| const fileGlob = process.argv[2] || 'src/**/*.*' | |
| const files = path.isAbsolute(fileGlob) |
| function createStringBuilder() { | |
| let str = ''; | |
| return function self(key) { | |
| switch (key) { | |
| case 'append': | |
| return (s) => { | |
| str += s; | |
| return self; | |
| }; | |
| case 'toString': |