Skip to content

Instantly share code, notes, and snippets.

View benpolinsky's full-sized avatar
🏠
Working

Ben Polinsky benpolinsky

🏠
Working
View GitHub Profile
@jacob-long
jacob-long / README.md
Created September 17, 2017 04:03
Prism.js line numbers plugin tweak

Notes on use

The idea here is that some of us always want line numbers but never want to add a "line-numbers" class to our HTML. This tweaked version of the plugin always adds the line numbers to any <pre> block that also has a language class that Prism will be highlighting.

To keep you from being boxed in, I've added an option to use the pre class to opt out by setting class = "no-line-numbers". If you are much more likely to want line numbers than to not want them, then this is the better way of doing things. If you think you usually don't want line numbers, then just use the plugin straight from Prism.

You should add this file after the main prism.js file on your page. Do not include the line-numbers plugin when you download Prism because you want this one to do the work and not conflict with the official one.

This may break at any time as the Prism.js teams changes the base functionality of the highlighter or the line numbers plugin.

@mcshakes
mcshakes / Rails C error.
Created October 14, 2016 23:45
Running into RVM and readline issues
$ rails c
Running via Spring preloader in process 7916
/Users/edmac/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require': dlopen(/Users/edmac/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin14/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib (LoadError)
Referenced from: /Users/edmac/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin14/readline.bundle
Reason: image not found - /Users/edmac/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin14/readline.bundle
Fixed with:
ln -s /usr/local/opt/readline/lib/libreadline.7.0.dylib /usr/local/opt/readline/lib/libreadline.6.dylib
@mcfadden
mcfadden / remove_stray_s3_files.rb
Created November 3, 2015 19:32
Remove Stray S3 Files
# Ever had an app/script that created a bunch of files in S3 without a matching database entry?
# This will find and remove any stray s3 files
# Requirements:
# Designed to be run in a rails console, with the `fog` gem installed
# Usage:
# Update `is_stray_file?` method to return the correct value for your use case
# Set ENV['AWS_ACCESS_KEY'] and ENV['AWS_SECRET_KEY']
# Optionally set ENV['AWS_BUCKET']
@bradmontgomery
bradmontgomery / install-comodo-ssl-cert-for-nginx.rst
Last active June 10, 2024 15:37
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@bantic
bantic / rails_route_recognizer.rb
Last active September 9, 2022 12:22
Programmatically list all routes (/paths) from within a rails app.
class RouteRecognizer
attr_reader :paths
# To use this inside your app, call:
# `RouteRecognizer.new.initial_path_segments`
# This returns an array, e.g.: ['assets','blog','team','faq','users']
INITIAL_SEGMENT_REGEX = %r{^\/([^\/\(:]+)}
def initialize