Skip to content

Instantly share code, notes, and snippets.

View sunny's full-sized avatar

Sunny Ripert sunny

View GitHub Profile
@pcreux
pcreux / turboframe_missing_handler.js
Created July 21, 2025 07:42
A developer friendly turboframe error handler
// Display a developer-friendly error message when Turbo Frame fails to load.
if (process.env.NODE_ENV === 'development') {
document.addEventListener('turbo:frame-missing', async function (event) {
event.preventDefault();
const frame = event.target;
const response = event.detail.response;
const frameId = frame.id;
const url = response?.url || frame.src;
@adrienne
adrienne / mullenweg-wpe.md
Last active November 22, 2025 13:16
The Mullenweg/WPE Thing
@jeromecornet
jeromecornet / File locations
Last active August 26, 2021 21:14
Tailwindcss with sprockets
tailwind_transformer.rb -> app/models/tailwind_transformer.rb
tailwind.rb -> config/initializers/tailwind.rb
tailwind.config.js.erb -> config/tailwind.config.js.erb
package.json -> ./package.json
@mislav
mislav / gh-rename-master
Last active April 24, 2022 10:02
Rename the default branch of a repository using GitHub CLI https://github.com/cli/cli/releases/tag/v0.10.0
#!/bin/bash
# Usage: gh-rename-master <newbranch> [<remote>]
#
# Renames the "master" branch of the current repository both locally and on GitHub.
#
# dependencies: GitHub CLI v0.10
set -e
newbranch="${1?}"
remote="${2:-origin}"
@Ynote
Ynote / dot-css-dot-js.md
Created November 10, 2018 11:28
[Conferences] Some thoughts about DotCSS and DotJS 2018

About DotJS and DotCSS 2018

This year, I preferred DotCSS to DotJS. Some talks were amazing and inspiring. The atmosphere was kind and I talked to some speakers ! (@frivoal, @natalyathree AAAANNNND @SaraSoueian <3 <3).

DotCSS

About text wrapping and line-breaking

This talk was done by Florian Rivoal. He describes some new features to handle line-breaks and text-wrapping better. Some are already implemented in some browsers, some not. What I noted :

  • Whitespace CSS rules (pre, preline, etc.) use several steps to deal with whitespace.
@MarceloCajueiro
MarceloCajueiro / script.rb
Created July 17, 2018 11:50
Move sidekiq jobs from one queue to another
queue = Sidekiq::Queue.new("default")
queue.each do |job|
if job.klass == "DailyFrequencyCreatorWorker"
DailyFrequencyCreatorWorker.set(queue: 'daily_frequency_creator').perform_async(*job.args)
job.delete
end
end;nil
@sunny
sunny / enumerator_lazy_compact_extension.rb
Last active September 7, 2019 16:16
Adds #compact to Lazy Enumerators in Ruby
class Enumerator::Lazy
def compact
reject(&:nil?)
end
end
@alassek
alassek / 01_Annotated_Source.md
Last active November 19, 2023 11:53
Extending Arel to support @> operator

I've been doing some work lately with JSON documents in PostgreSQL using jsonb columns. You can query these documents using a GIN index in PG, but the syntax can be a little cumbersome

SELECT "events".* FROM "events" WHERE "events"."body" @> '{"shift":{"user_id":2}}'

You have to construct the right side of the query as a JSON string, which is a bit annoying. So I wondered if I could adapt Arel to do the tedious stuff for me.

@scmx
scmx / react-proptype-warnings-as-errors-with-sinon.markdown
Last active March 1, 2019 08:42
Make React PropType warnings throw errors with mocha.js, enzyme.js and sinon.js

Make React PropType warnings throw errors with enzyme.js + sinon.js + mocha.js

A simple stateless functional component that we want to test that it renders without propType warnings.

import React, { PropTypes } from 'react'

let VersionListItem = function ({ active, version }) {
  return (