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
| let holding = false | |
| let id = 0 | |
| let TOTAL = 2 | |
| // Setup: secretly do this on the first micro:bit | |
| input.onLogoEvent(TouchButtonEvent.Pressed, function () { | |
| holding = true | |
| }) | |
| // Set IDs for each micro:bit |
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
| alias: Sync Enyaq SoC to Ohme | |
| triggers: | |
| - trigger: state | |
| entity_id: | |
| - sensor.skoda_enyaq_coupe_battery_percentage | |
| - sensor.ohme_home_pro_vehicle_battery | |
| not_to: | |
| - unknown | |
| - unavailable | |
| conditions: |
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
| <base> | |
| [pedl]>[hk2] | |
| {hk2}>{-lwin}{spc}{+lwin} |
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 "argon2id" | |
| require "bcrypt" | |
| # Schema: User(name: string, password_digest:string) | |
| class User < ApplicationRecord | |
| attr_reader :password | |
| validates :password_digest, presence: true | |
| validates :password, confirmation: true, allow_blank: true |
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
| <%= form_with model: @post, data: { controller: 'upload', action: 'direct-upload:error@window->upload#error' } do |f| %> | |
| <%= f.file_field(:image, data: { 'direct-upload-url' => uploads_url }) %> | |
| <%= f.submit %> | |
| <% 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
| Rails.application.configure do | |
| # Add Cloudflare's IPs to the trusted proxy list so they are ignored when | |
| # determining the true client IP. | |
| # | |
| # See https://www.cloudflare.com/ips-v4/ and https://www.cloudflare.com/ips-v6/ | |
| config.action_dispatch.trusted_proxies = ActionDispatch::RemoteIp::TRUSTED_PROXIES + %w[ | |
| 173.245.48.0/20 | |
| 103.21.244.0/22 | |
| 103.22.200.0/22 | |
| 103.31.4.0/22 |
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
| class ApiController < ApplicationController | |
| before_action :only_respect_accept_header | |
| private | |
| # By default, Rails will ignore the Accept header if it contains a wildcard | |
| # and assume the client wants HTML (or JS if using XMLHttpRequest). See | |
| # https://github.com/rails/rails/blob/a807a4f4f95798616a2a85856f77fdfc48da4832/actionpack/lib/action_dispatch/http/mime_negotiation.rb#L171-L173 | |
| # | |
| # If you don't expect your clients to be browsers, we want to override this |
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
| cask "pdftk" do | |
| version "2.02" | |
| sha256 "c33cf95151e477953cd57c1ea9c99ebdc29d75f4c9af0d5f947b385995750b0c" | |
| url "https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk_server-#{version}-mac_osx-10.11-setup.pkg" | |
| name "PDFtk" | |
| desc "Tool for doing everyday things with PDF documents" | |
| homepage "https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/" | |
| pkg "pdftk_server-2.02-mac_osx-10.11-setup.pkg" |
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 'base64' | |
| class DataUri | |
| REGEXP = %r{ | |
| data: | |
| (?<mediatype> | |
| (?<mimetype> .+? / .+? )? | |
| (?<parameters> (?: ; .+? = .+? )* ) | |
| )? | |
| (?<extension>;base64)? |
NewerOlder