Skip to content

Instantly share code, notes, and snippets.

View dorianmariecom's full-sized avatar

Dorian Marié dorianmariecom

View GitHub Profile
.rainbow {
-webkit-background-clip: text;
-moz-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
-moz-text-fill-color: transparent;
text-fill-color: transparent;
background-size: 100%;
background-image: linear-gradient(
90deg,
= javascript_tag nonce: true do
' (function() {
' const images = [...document.querySelectorAll("img")];
' let count = 0;
'
' const ready = () => {
' const div = document.createElement("div");
' div.id = "HCTIReadyNow";
' document.body.appendChild(div);
' };
{
en: {
i18n: {
plural: {
keys: [:one, :other],
rule: lambda do |n|
if n == 1
:one
else
:other
#!/usr/bin/env ruby
# frozen_string_literal: true
require "yaml"
if ARGV.size != 2
puts "USAGE: yaml-merge file_1.yml file_2.yml"
exit
end
const SUBJECT_LINE_EN = "So, what do you think?"
const SUBJECT_LINE_FR = "Alors, t'en penses quoi ?"
const FROM = "dorian@socializus.app"
const NAME = "Dorian"
const FIRST_NAME_COLUMN = "first_name"
const EMAIL_COLUMN = "email"
const LOCALE_COLUMN = "locale"
const SENT_COLUMN = "sent"
function onOpen() {
@dorianmariecom
dorianmariecom / generate-certificate.sh
Last active December 4, 2021 07:50
Generate certificate for HTTPS on localhost macOS / Rails / Puma
#!/bin/bash
set -e
echo "> Removing certificate"
sudo security delete-certificate -c localhost || true
echo "> Generating .key"
sudo openssl genrsa -out config/localhost.key 4096
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
gem "rails"
gem "sqlite3"
end
require "active_record"
require "logger"
{
inputs:
[params[:authenticity_token], request.x_csrf_token].map do |token|
Base64.urlsafe_decode64(token)
end.map do |token|
xor_byte_strings(
token[0...AUTHENTICITY_TOKEN_LENGTH],
token[AUTHENTICITY_TOKEN_LENGTH..-1]
)
end,
module RenderJpgConcern
MIN_WIDTH = 20
MAX_WIDTH = 1000
MIN_HEIGHT = 20
MAX_HEIGHT = 1000
DEFAULT_WIDTH = 400
DEFAULT_HEIGHT = 300
def render_jpg(model)
http_cache_forever(public: true) do
@dorianmariecom
dorianmariecom / .github-slash-workflows-slash-auto-merge.yml
Last active November 10, 2021 15:33
Auto-merge dependabot pull requests on minor and patch version upgrades when CI passes (yeah) `.github/workflows/auto-merge.yml`
---
jobs:
auto-merge:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ahmadnassri/action-dependabot-auto-merge@v2
with:
github-token: "${{ github.token }}"
target: minor