Skip to content

Instantly share code, notes, and snippets.

View dorianmariecom's full-sized avatar

Dorian Marié dorianmariecom

View GitHub Profile
import { Controller } from "stimulus"
export default class extends Controller {
connect() {
if (typeof window.google !== "undefined") {
this.initMap()
}
}
initMap() {
config.lograge.enabled = true
config.lograge.ignore_actions = %w[
ActiveStorage::DiskController#show
ActiveStorage::RepresentationsController#show
ActiveStorage::Representations::RedirectController#show
ActiveStorage::Representations::ProxyController#show
]
@dorianmariecom
dorianmariecom / textarea_controller.js
Last active June 8, 2021 20:18
Stimulus-based auto-expanding textarea
import { Controller } from "stimulus"
export default class extends Controller {
handle(event) {
event.target.rows = event.target.value.split("\n").map((row) => {
return Math.ceil((row.length + 1) / event.target.cols)
}).reduce((acc, el) => acc + el)
}
}
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "rails", github: "rails/rails", branch: "main"
require "rspec"
class Class
def |(other)
Type.new(self, other)
end
def class_of?(object)
object.is_a?(self)
end
AllCops:
NewCops: enable
Exclude:
- "react-native/**/*"
- "node_modules/**/*"
- "vendor/**/*"
- "db/schema.rb"
- "bin/*"
inherit_gem:

Keybase proof

I hereby claim:

  • I am dorianmariefr on github.
  • I am dorianmariefr (https://keybase.io/dorianmariefr) on keybase.
  • I have a public key ASAUNCdqpfjTyGSxH3xmiybUg0rv7fcXJ-a_l3M4k0kSWAo

To claim this, I am signing this object:

def easy_translate(original, from:, to:)
capitalized = original[0] == original[0].upcase
interpolations_in_original = original.scan(/%{[^}]+}/)
spaces_before = original.scan(/\A */).first
spaces_after = original.scan(/ *\z/).first
translated_text =
EasyTranslate.translate(original, from: from, to: to).strip
translated_text = translated_text.gsub(/(.)% {/, '\1 %{')
translated_text = translated_text.gsub("% {", "%{")
translated_text =
#!/usr/bin/env ruby
if ARGV.size < 2
puts "USAGE: ruby-replace FROM TO FILES..."
puts
puts "ALTERNATIVE:"
puts "ls | ruby-replace FROM TO"
exit
end
/* global __DEV__ */
import React, { useState, useEffect, useRef } from "react"
import {
facebookAppId,
facebookDisplayName,
iosOneSignalAppId,
androidOneSignalAppId,
sentryDsn,
} from "./app.json"
import { version } from "./package.json"