Skip to content

Instantly share code, notes, and snippets.

View vesan's full-sized avatar

Vesa Vänskä vesan

View GitHub Profile
@jdbrice
jdbrice / md-cal.sh
Last active October 8, 2024 11:49
Generate markdown table calendar. Use wiki links to individual days
# Author: Daniel Brandenburg
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@maxfenton
maxfenton / uses.md
Last active November 8, 2024 16:46
Uses

/uses

a document about the tools I use to do my work as a web developer

Software

First of all

title type
oh-my-zsh terminal flavor
@peterc
peterc / form-to-fetch.js
Last active December 15, 2020 21:11
Basic implementation of turning forms into an Ajax form using Fetch API
document.querySelectorAll("FORM[method='post']").forEach(form => {
form.onsubmit = function(e) {
e.preventDefault();
let formData = new FormData(e.target);
let output = e.target.querySelector('button');
fetch(e.target.action, { method: 'post', body: formData })
.then( res => {
console.log("Happy days");
})
.catch( err => {
@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
@davideluque
davideluque / !README.MD
Last active May 3, 2025 21:04
Sign in with Apple in Ruby on Rails using apple_id gem.

Sign in with Apple Implementation for Ruby on Rails

Note: Before diving into this implementation, consider that there are more popular and potentially easier-to-use solutions for implementing Sign in with Apple in Ruby on Rails, such as Omniauth. If you prefer a more out-of-the-box approach, explore those alternatives.

Overview

This implementation of the Sign in with Apple service in Ruby on Rails is suitable for APIs, eliminating the need for views.

Features

Hi Tom!

Here's what the Markdown for a book looks like on macwright.org:

---
categories:
  - book
layout: book
title: 'My Year of Rest and Relaxation'

Migrating @reach/router to React Router v6

Note: This document is still a work in progress! Please let us know where it lacks so we can make the migration as smooth as possible!

Introduction

When we set out to build React Router v6, from the perspective of @reach/router users, we had these goals:

  • Keep the bundle size low. Turns out we got it smaller than @reach/router
@developit
developit / *constant-locals-loader.md
Last active February 4, 2022 17:15
Inline Webpack CSS Modules classNames, reducing bundle size. https://npm.im/constant-locals-loader

constant-locals-loader for Webpack

This loader optimizes the output of mini-css-extract-plugin and/or css-loader, entirely removing the potentially large CSS classname mappings normally inlined into your bundle when using CSS Modules.

Run npm install constant-locals-loader, then make these changes in your Webpack config:

module.exports = {
 module: {
@amkisko
amkisko / list_extension.rb
Last active April 6, 2020 20:17
GraphQL Ruby List extension
class FieldExtensions::ListExtension < GraphQL::Schema::FieldExtension
def apply
object_type = field.type.unwrap
list_type_name = object_type.graphql_name
namespace = options[:namespace] || "default"
list_type =
Class.new(Objects::BaseObject) do
self.graphql_name("#{namespace}_#{list_type_name}_list")
self.field(:rows, [object_type], null: true)
@elrayle
elrayle / byebug_commands.md
Last active September 15, 2025 14:04
Byebug Cheatsheet - organized by related commands

Byebug Cheatsheet

This cheatsheet includes most of the byebug commands organized by related commands (e.g. breakpoint related commands are together).

To see official help...

Command Aliases Example Comments
help h h list top level of all commands
help cmd h cmd-alias h n list the details of a command (example shows requesting details for the next command) (this works for all commands)