Skip to content

Instantly share code, notes, and snippets.

@marcjulianschwarz
marcjulianschwarz / github-old-dashboard.js
Last active September 22, 2023 13:30
Bring back the old GitHub dashboard with PageExtender for Safari
if (window.location.hostname === "github.com") {
const feedContent = document.querySelector('.feed-content')
if (feedContent){
const feedMain = document.querySelector('.feed-main')
feedContent.style.maxWidth = "unset"
feedMain.style.maxWidth = "1200px"
fetch('https://github.com/dashboard-feed')
.then(response => response.text())
.then(text => {

How to install game-porting-toolkit (aka proton for macOS)

You also might wanna just use Whisky which does this automatically

This guide works on macOS 13.4+ using Command Line Tools for XCode 15 Beta!

What is this?

In the recent WWDC, Apple announced and released the "game porting toolkit", which upon further inspection this is just a modified version of CrossOver's fork of wine which is a "compatibility layer" that allows you to run Windows applications on macOS and Linux.

@jjb
jjb / file.md
Last active April 19, 2024 09:09
Using Jemalloc 5 with Ruby.md

For years, people have been using jemalloc with ruby. There are various benchmarks and discussions. Legend had it that Jemalloc 5 doesn't work as well as Jemalloc 3.

Then, one day, hope appeared on the horizon. Someone offered a config for Jemalloc 5.

The recipe would be something like this (shown with official docker ruby image).

FROM ruby:3.1.2-bullseye

Find the difference

You are given two strings s and t.

String t is generated by random shuffling string s and then add one more letter at a random position.

Return the letter that was added to t.

Example 1:

@2called-chaos
2called-chaos / z_airbrake.rb
Last active June 9, 2022 00:25
Airbrake config example for Errbit
Airbrake.configure do |config|
# project specific
config.project_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
# use git SHA & current commit as app version
config.app_version = "Ruby: #{RUBY_VERSION} » Rails: #{Rails::VERSION::STRING} » " << `cd #{Rails.root} && git log -1 --pretty="%h - %B" HEAD`
# can always be 1
config.project_id = 1
@brenogazzola
brenogazzola / custom_active_storage_urls.rb
Last active October 17, 2022 15:34
Creating a custom ActiveStorage controller to generate "pretty urls" or help migration from another lib
# This demonstrates how we create a SEO friendly url for the previews of the artworks we sell.
#
# This is the URL we want:
# https://festalab.com.br/image/invitation/birthday/carnival.jpg
#
# First, the route.
#
# "model" is the name of the active storage model that has the preview.
# "classification" and "identifier" are together a unique key for the records.
// This code is to be used with https://turbo.hotwire.dev. By default Turbo keeps visited pages in its cache
// so that when you visit one of those pages again, Turbo will fetch the copy from cache first and present that to the user, then
// it will fetch the updated page from the server and replace the preview. This makes for a much more responsive navigation
// between pages. We can improve this further with the code in this file. It enables automatic prefetching of a page when you
// hover with the mouse on a link or touch it on a mobile device. There is a delay between the mouseover event and the click
// event, so with this trick the page is already being fetched before the click happens, speeding up also the first
// view of a page not yet in cache. When the page has been prefetched it is then added to Turbo's cache so it's available for
// the next visit during the same session. Turbo's default behavior plus this trick make for much more responsive UIs (non SPA).
@jferris
jferris / configmap.yaml
Last active February 8, 2024 14:15
Rails Kubernetes Manifests
apiVersion: v1
kind: ConfigMap
metadata:
name: example
namespace: default
data:
APPLICATION_HOST: example.com
LANG: en_US.UTF-8
PIDFILE: /tmp/server.pid
PORT: "3000"
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem "rails"
gem "sqlite3"
gem "jbuilder"
gem "active_model_serializers"
@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers