Skip to content

Instantly share code, notes, and snippets.

View aseroff's full-sized avatar

Andrew Seroff aseroff

View GitHub Profile
@chetan
chetan / yardoc_cheatsheet.md
Last active May 10, 2024 02:53
YARD cheatsheet
@zenorocha
zenorocha / README.md
Last active May 28, 2024 08:23
A template for Github READMEs (Markdown) + Sublime Snippet

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage

# config/routes.rb
resources :documents do
scope module: 'documents' do
resources :versions do
post :restore, on: :member
end
resource :lock
end
end
@kyledrake
kyledrake / ferengi-plan.txt
Last active April 6, 2024 00:30
How to throttle the FCC to dial up modem speeds on your website using Nginx
# The blog post that started it all: https://neocities.org/blog/the-fcc-is-now-rate-limited
#
# Current known FCC address ranges:
# https://news.ycombinator.com/item?id=7716915
#
# Confirm/locate FCC IP ranges with this: http://whois.arin.net/rest/net/NET-165-135-0-0-1/pft
#
# In your nginx.conf:
location / {
@raecoo
raecoo / awk-example.sh
Last active September 21, 2023 07:12
awk/grep commands for Rails log analysis
# Access number
cat production.log | grep "^Processing" | wc | awk '{print $1}'
# Each IP access number
cat production.log | grep “^Processing” | awk ‘{print $4}’ | uniq -c
# Independent IP number
cat production.log | grep "^Processing" | awk '{print $4}' | uniq | wc | awk '{print $1}'
cat production.log | grep “^Processing” | awk ‘{print $4}’ | uniq | wc -l
@venantius
venantius / gist:ba11dc49cc7a770a3420
Created December 9, 2015 05:09
Rubocop summary stats generator
#!/usr/bin/env python3
"""
A little script to quickly identify the worst offenders. Easily extensible to
find and sort by other issues. Expects you to have results available in an
easily consumable JSON file, which you can generate by running:
rubocop --format progress --format json --out rubocop.json
"""
@phansch
phansch / yardoc_cheatsheet.md
Last active June 26, 2024 12:23 — forked from chetan/yardoc_cheatsheet.md
Improved YARD cheatsheet
@mrmartineau
mrmartineau / stimulus.md
Last active May 12, 2024 04:35
Stimulus cheatsheet
// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var elements = document.body.getElementsByTagName('*');
var items = [];
for (var i = 0; i < elements.length; i++) {
if (elements[i].innerHTML.indexOf('* { background:#000!important;color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }') != -1) {
items.push(elements[i]);
}
}
@varyform
varyform / multiple_importmaps.rb
Last active April 3, 2024 21:58
Multiple importmaps
# config/initializers/public_importmap.rb
Rails.application.config.public_importmap = Importmap::Map.new
Rails.application.config.public_importmap.draw(Rails.root.join("config/public_importmap.rb"))
# app/helpers/application_helper.rb
# copied from importmaps replacing javascript_inline_importmap_tag
#
# !!! No longer needed after this change https://github.com/rails/importmap-rails/pull/187
#
# def javascript_public_importmap_tags(entry_point = "application", shim: true)