Skip to content

Instantly share code, notes, and snippets.

View emilio2hd's full-sized avatar

Emílio emilio2hd

  • Limerick, Ireland
View GitHub Profile
@justin808
justin808 / .pryrc
Last active April 4, 2024 11:04
Updated .pryrc with option to remove pry-byebug
# Using these pry gems -- copy to your Gemfile
# group :development, :test do
# gem 'awesome_print' # pretty print ruby objects
# gem 'pry' # Console with powerful introspection capabilities
# # pick either:
# # using byebug, but has issues with Zeitwerk
# gem 'pry-byebug' # Integrates pry with byebug
#
# # using default ruby debuggger
# gem 'pry-stack_explorer'

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@btroncone
btroncone / rxjs_operators_by_example.md
Last active July 16, 2023 14:57
RxJS 5 Operators By Example
@juno
juno / custom_log_formatter.rb
Created August 12, 2015 08:23
Custom log formatter which supprots severity and progname. This works well with Heroku's rails_12factor.gem
# Custom log formatter module for rails_12factor
#
module CustomLogFormatter
# Custom formatter for development environment.
#
# Examples
#
# # in controller
# logger.error(self.class) { 'This is a error message' }
# logger.info { 'This is a info message' }
@rogerleite
rogerleite / converters.rb
Last active September 17, 2018 22:39
Ruby and CSV examples
require "csv"
require "date"
puts CSV::HeaderConverters.keys.inspect # => [:downcase, :symbol]
# Add new header converter
CSV::HeaderConverters[:remap] = lambda do |raw_value|
raw_value = raw_value.to_sym
case raw_value
when :country
@skanev
skanev / README.md
Last active October 26, 2023 12:02 — forked from valo/README.md
Hacky git diff syntax highlighting for the full code

Hacky syntax highlighting in git diff

Normally git diff would color additions green and deletions red. This is cool, but it would be even cooler if it adds syntax highlighting to those lines. This is a git pager that does so.

It parses the diff output and picks up the SHAs of files with additions and deletions. It uses [CodeRay][coderay] to highlight each file and then it extracts the lines that are shown in the diff. It then uses [term/ansicolor][color] to make a gradient from the CodeRay color and the diff color (red for deletion, green for addition) and uses it to replace the original.

I tried using rugged instead of shelling out to git show – it was faster overall, but it did incur a noticeable start up time.

Check out the image below for a demo.

@staltz
staltz / introrx.md
Last active May 9, 2024 07:59
The introduction to Reactive Programming you've been missing
@itzg
itzg / AbstractRepositoryTest.java
Last active December 19, 2022 00:44
Using Sping's JUnit runner to build-up a Postgres database environment where the schema is managed by Liquibase. The tables are automatically emptied before each test method.
import javax.sql.DataSource;
import org.junit.runner.RunWith;
import org.skife.jdbi.v2.DBI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
@Iristyle
Iristyle / Start-Vagrant.bat
Created March 15, 2013 18:35
Windows startup script to fire up a Vagrant VM safely on boot (using Run registry key for instance)
ECHO OFF
cd /d %~dp0
for /f "tokens=2* delims= " %%F IN ('vagrant status ^| find /I "default"') DO (SET "STATE=%%F%%G")
ECHO Close this window if it remains open, and http://localhost:8081 is responsive
IF "%STATE%" NEQ "saved" (
ECHO Starting Vagrant VM from powered down state...
vagrant up
) ELSE (
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: