Skip to content

Instantly share code, notes, and snippets.

View joram77's full-sized avatar

Joram Declerck joram77

View GitHub Profile
@nevans
nevans / IMAP-RFCs.md
Last active November 28, 2023 12:48
IMAP Specifications

IMAP specifications

(TODO) All IANA registered IMAP capabilities, response codes, keywords, mailbox attributes, the most relevant SASL mechanisms, and other relevant specifications.

  • ⛔️: obsolete specifications that have been deprecated or replaced
  • ⏭️: extensions that have been completely or partially included in [IMAP4rev2].
  • ✨: extensions that are recommended for [IMAP4rev2] servers and clients. The IETF EXTRA WG decided that requiring them as a part of IMAP4rev2 would push the bar to implement too high for new implementations.
  • 🗑: extensions that have been completely or partially deprecated or removed in [IMAP4rev2].
  • 🍋: extensions that are included in the "Lemonade" profile [RFC5550].
@jhcheung
jhcheung / fields_for_not_nested.html.rb
Created November 13, 2019 03:55
fields_for not nested
<%= form_tag 'topics/edit_all' do %>
<% @topics.each do |topic| %>
<%= fields_for "topics[]", topic do |f| %>
<%= f.check_box :enabled %>
<%= f.label topic["name"] %><br />
<% end %>
<% end %>
<%= submit_tag %>
<% end %>
@jakub-g
jakub-g / async-defer-module.md
Last active May 29, 2024 20:55
async scripts, defer scripts, module scripts: explainer, comparison, and gotchas

<script> async, defer, async defer, module, nomodule, src, inline - the cheat sheet

With the addition of ES modules, there's now no fewer than 24 ways to load your JS code: (inline|not inline) x (defer|no defer) x (async|no async) x (type=text/javascript | type=module | nomodule) -- and each of them is subtly different.

This document is a comparison of various ways the <script> tags in HTML are processed depending on the attributes set.

If you ever wondered when to use inline <script async type="module"> and when <script nomodule defer src="...">, you're in the good place!

Note that this article is about <script>s inserted in the HTML; the behavior of <script>s inserted at runtime is slightly different - see Deep dive into the murky waters of script loading by Jake Archibald (2013)

@hyfen
hyfen / .bashrc
Created June 12, 2017 01:08
Save unlimited bash history in OSX
# save history to ~/.bash_history as soon as command is run
export PROMPT_COMMAND='history -a'
# save unlimited history
# osx doesn't seem to respect =-1 or = options
export HISTSIZE=9999999999
export HISTFILESIZE=999999999
# osx doesn't actually respect this and it'll fall back to unix timestamp (which we want)
export HISTTIMEFORMAT="%d/%m/%y %T "
@eliotsykes
eliotsykes / multiline_expressions_in_ruby.md
Last active September 28, 2023 08:03
Multiline expressions in Ruby

How to break long lines up in Ruby

This page lists the options for breaking single-line expressions into multiple lines in Ruby.

Developers and teams need to come to their own decisions about which guideline(s) they prefer (preferences below are just my personal choices and I encourage you to disregard them).

# With trailing parens
x = [1, 2, 3].join(
 '-'
@davebarnwell
davebarnwell / PHP composer tools.md
Last active May 19, 2024 20:13
Global installation of PHP tools with Composer

Global installation of PHP tools with Composer

To install a composer package globally, you run the usual require command, but with the addition of the global modifier. So to install PHPUnit, you would run:

$ composer global require phpunit/phpunit
$ composer global require phpunit/dbunit
$ composer global require phing/phing
$ composer global require phpdocumentor/phpdocumentor
$ composer global require sebastian/phpcpd
@pimpin
pimpin / have_xml.rb
Last active November 30, 2022 17:37 — forked from faun/have_xml.rb
require 'nokogiri'
RSpec::Matchers.define :have_xml do |xpath, text|
match do |body|
doc = Nokogiri::XML::Document.parse(body)
nodes = doc.xpath(xpath)
expect(nodes).to_not be_empty
if text
nodes.each do |node|
cdata = node.children.find { |e| e.cdata? }
value_to_check = node.text
@subfuzion
subfuzion / global-gitignore.md
Last active May 29, 2024 12:00
Global gitignore

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file:

  • Create a file called .gitignore in your home directory and add any filepath patterns you want to ignore.
  • Tell git where your global gitignore file is.

Note: The specific name and path you choose aren't important as long as you configure git to find it, as shown below. You could substitute .config/git/ignore for .gitignore in your home directory, if you prefer.

@goyalankit
goyalankit / bash_to_zsh_history.rb
Last active October 28, 2023 05:07
Import bash history to zsh history.
#################################################################
# = This script transfers bash history to zsh history
# = Change bash and zsh history files, if you don't use defaults
#
# = Usage: ruby bash_to_zsh_history.rb
#
# = Author: Ankit Goyal
#################################################################
# change if you don't use default values
@otobrglez
otobrglez / jaccard_recommendation.rb
Last active April 2, 2024 17:51
Simple recommendation system written in Ruby based on Jaccard index.
# Simple Recommendation Engine in Ruby
# Visit: http://otobrglez.opalab.com
# Author: Oto Brglez <otobrglez@gmail.com>
class Book < Struct.new(:title)
def words
@words ||= self.title.gsub(/[a-zA-Z]{3,}/).map(&:downcase).uniq.sort
end