Skip to content

Instantly share code, notes, and snippets.

Arthur Nogueira Neves arthurnn

Block or report user

Report or block arthurnn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@olivierlacan
olivierlacan / github_conflict_resolution.md
Created Aug 29, 2015
I dream of easier merge conflict resolution on GitHub Pull Requests
View github_conflict_resolution.md

Howdy,

It's currently a bit of a hassle (unless I'm doing it wrong) to fix a PR that used to be green but is now unmergeable due to an simple little merge conflict with master.

It would be quite fantabulous if I could access the swanky invisible PR branches from the web interface in order to quickly fix the merge conflict and merge/close the PR without having to:

  • ask & wait for the submitter to fix a conflict they might not understand better than I do (since master likely caused it if the branch is green)
  • tediously add the submitter's repo as a remote and pull their branch, merge master in it to fix the conflict and either submit a PR to their fork or merge it into master directly (which sadly by-passes the existing PR)
  • do the local PR checkout trick (but I'm lazy, don't make me do it!)

A dream solution that would make GitHub even more addictive would be an interactive conflict resolutio

View action_controller_redirect_patch.rb
module ActionControllerRedirectPatch
extend ActiveSupport::Concern
class BadRedirectTo < StandardError; end
included do
config_accessor :allowed_url_protocols
self.allowed_url_protocols = ["http", "https", "mailto"]
end
@wisq
wisq / gist:0fa021df52a3bd2485ac
Last active Jul 11, 2019
Protip: Bisecting a single commit
View gist:0fa021df52a3bd2485ac

Situation: Some commit (on master, but not necessarily head of master) has broken things, but it's a big commit and it's not clear what part broke things.

% git checkout master
% git checkout -b bisect-branch
% git revert <offending commit>

(test here to make sure reverting fixed your problem)

% git bisect start
View gist:10130454
#!/usr/bin/env python
# Quick and dirty demonstration of CVE-2014-0160 by
# Jared Stafford (jspenguin@jspenguin.org)
# Modified so that it finds cookies
import sys
import struct
import socket
import time
import select
@dylanahsmith
dylanahsmith / test.rb
Last active Jan 15, 2019
mysql2 EINTR on connect error reproduction
View test.rb
#!/usr/bin/env ruby
require 'mysql2'
trap("USR2") {}
pid = fork do
loop do
client = Mysql2::Client.new
client.close
View gist:8738842
Hi David
I'm impressed with your back ground and your responsibilities at 37signals. When researching your profile I also found that you have 4.8K followers and have been starred 29 times on GitHub. This speaks volumes to your work and your high technical expertise. I'd love the opportunity to speak with you about a Ruby Engineering role I'm currently working on for Heroku. I'd like to share more details about the position and find out if you or anyone you know would be interested.
Heroku is a Platform as a Service (PaaS) that lets you deploy, run and manage applications written in Ruby, Node.js, Java, Python, Clojure and Scala. Heroku is owned by Salesforce however, we operate as a completely separate entity. This allows us to maintain our technology, culture and the formula that has made us so successful.
Anyway, it would be great to set up sometime to chat. I am more than happy to answer any questions that you might have and it would be great for me to hear about what you are looking for in any potentia
@xaviershay
xaviershay / ruby_live_gc_stats.rb
Created Nov 10, 2013
naive jstat proof-of-concept for ruby
View ruby_live_gc_stats.rb
Thread.new do
GC::Profiler.enable
current_message = ""
epoch = Time.now
total_time = 0
gc_events = 0
heap_use = 0
heap_size = 0
fmt = "%7s %5s %15s %15s %10s"
View tmux.conf
unbind C-b
set -g prefix C-a
bind a send-prefix
unbind ^C
bind ^C new-window
bind c new-window
unbind ^a
bind C-a last-window
anonymous
anonymous / timed_versioning.rb
Created Dec 17, 2012
Basic Mongoid versioning extension, where version number is timestamp. This allows to use method version_at to get object at specific time
View timed_versioning.rb
# encoding: utf-8
module Mongoid
# Include this module to get automatic versioning of root level documents.
# This will add a version field to the +Document+ and a has_many association
# with all the versions contained in it.
module TimedVersioning
extend ActiveSupport::Concern
@dblock
dblock / carrierwave.rb
Created Jan 31, 2012
Delayed image processing with CarrierWave
View carrierwave.rb
CarrierWave.configure do |config|
...
end
Mongoid::Document::ClassMethods.send(:include, DelayedImageProcessing)
module CarrierWave
# http://sleeplesscoding.blogspot.com/2011/09/recreate-single-version-of.html
# Note: is_processing_delayed should be set before calling recreate_version! if the version depends on it.
You can’t perform that action at this time.