Skip to content

Instantly share code, notes, and snippets.

View nmeylan's full-sized avatar

Nicolas Meylan nmeylan

View GitHub Profile
@jtanium
jtanium / recognize_path.rb
Last active March 11, 2025 21:12
Ruby module that can recognize paths of the main Rails application as well as the engines.
module RecognizePath
def recognize_path(path, options)
recognized_path = Rails.application.routes.recognize_path(path, options)
# We have a route that catches everything and sends it to 'errors#not_found', you might
# need to rescue ActionController::RoutingError
return recognized_path unless recognized_path.slice(:controller, :action) == {controller: 'errors', action: 'not_found'}
# The main app didn't recognize the path, try the engines...
Rails.application.railties.engines.each do |engine|
@JohnathanMarkSmith
JohnathanMarkSmith / MavenInstall.txt
Last active December 17, 2022 15:20
How to install Maven on Fedora, CentOS, Red Hat and Scientific Linux
How to install Maven on Fedora, CentOS, Red Hat and Scientific Linux
If you are using Fedora, CentOS, Red Hat or Scientific Linux sometimes yum does not have the package for the product you would like to install and Maven is one of them at the time of me writing this blog.
I am going to show you how I install Maven on Fedora, CentOS, Red Hat or Scientific Linux you can do it the same way or find a better way.
Download Maven and untar it.
The first thing we need to do is to download the Maven tar file and untar it to a shared location on the workstation
wget http://mirrors.gigenet.com/apache/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz
@m3nd3s
m3nd3s / NERDTree.mkd
Last active December 19, 2025 17:05
My Vim Cheat Sheet

NERDTree

o.......Open files, directories and bookmarks....................|NERDTree-o|
go......Open selected file, but leave cursor in the NERDTree.....|NERDTree-go|
t.......Open selected node/bookmark in a new tab.................|NERDTree-t|
T.......Same as 't' but keep the focus on the current tab........|NERDTree-T|
i.......Open selected file in a split window.....................|NERDTree-i|
gi......Same as i, but leave the cursor on the NERDTree..........|NERDTree-gi|
s.......Open selected file in a new vsplit.......................|NERDTree-s|
gs......Same as s, but leave the cursor on the NERDTree..........|NERDTree-gs|

O.......Recursively open the selected directory..................|NERDTree-O|

@jboner
jboner / latency.txt
Last active January 29, 2026 01:35
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD