Skip to content

Instantly share code, notes, and snippets.

View dorianmariecom's full-sized avatar

Dorian Marié dorianmariecom

View GitHub Profile
function createThumbControl(thumbObject, thumb, minValue, maxValue, pixels, orientation) {
if (orientation !== 'horizontal' && orientation !== 'vertical') {
throw new Error('Orientation must be either \'horizontal\' or \'vertical\'');
}
if (isNaN(thumb.stepSize)) {
throw new Error('Step size must be a number.');
}
if (isNaN(thumb.initialValue)) {
this.card = this.elements.create("card", { style: {
base: {
"::placeholder": {
textTransform: "lowercase"
}
}
}})
@dorianmariecom
dorianmariecom / index.html
Last active July 27, 2020 09:37 — forked from mdamien/index.html
Reddit activity as a calendar view
<!DOCTYPE html>
<body>
<style>
body {
font-family: sans-serif;
padding: 20px;
margin: 0;
}
</style>
<form>
diff --git a/spec/compiler/crystal/tools/init_spec.cr b/spec/compiler/crystal/tools/init_spec.cr
index 7d59a6586..49199397c 100644
--- a/spec/compiler/crystal/tools/init_spec.cr
+++ b/spec/compiler/crystal/tools/init_spec.cr
@@ -6,6 +6,7 @@ require "ini"
require "spec"
require "yaml"
require "../../../support/tempfile"
+require "../../../support/env"
// ==UserScript==
// @name De-Culture-War Hacker News
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Hides any Hacker News story with more comments than points.
// @author Nate Berkopec
// @include https://news.ycombinator.com/*
// @grant none
// ==/UserScript==
import { Controller } from "stimulus"
import strftime from "strftime"
import { capitalize } from "src/helpers"
const LOCALIZED_STRFTIME = {
en: strftime.localizeByIdentifier("en_US"),
fr: strftime.localizeByIdentifier("fr_FR"),
es: strftime.localizeByIdentifier("es_MX"),
it: strftime.localizeByIdentifier("it_IT"),
de: strftime.localizeByIdentifier("de_DE"),
@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: