Skip to content

Instantly share code, notes, and snippets.

Phil Hansch phansch

Block or report user

Report or block phansch

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
View macros.patch
diff --git a/tests/ui/auxiliary/ b/tests/ui/auxiliary/
index 486e419b..2d8d571d 100644
--- a/tests/ui/auxiliary/
+++ b/tests/ui/auxiliary/
@@ -7,3 +7,9 @@ macro_rules! foofoo {
loop {}
+macro_rules! must_use_unit {
View Dockerfile
FROM i386/buildpack-deps:stretch
# The rustup installation code is taken from
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUN set -eux; \
phansch / app.js
Last active Oct 24, 2018
vue-tables-2 pagination on top and bottom
View app.js
import {Event, ServerTable} from 'vue-tables-2';
import Vue from 'vue/dist/vue.esm';
var template = require('template.js')('server');
Vue.use(ServerTable, options, false, template);
phansch / stuck.rb
Created Nov 27, 2017
Debugging stuck Ruby processes
View stuck.rb
# Use this to get the stacktrace of any ruby process by calling kill -USR1 <pid>
# For rspec, put this in the spec_helper.rb, for rails in some initializer.
puts "ruby process pid: #{}"
trap 'USR1' do
threads = Thread.list
puts "=" * 80
puts "Received USR1 signal; printing all #{threads.count} thread backtraces."

Things to check at work:

  • Is the rubocop.yml actually in the installed gem? It may be, that it hasn't been included in the install version.
  • Is there a ~/.rubocop.yml with the same content?
  • Is Rubocop up-to-date?



View gist:6a0b65eba6bbb0d49ce177ec98fca6c8
Version info
qutebrowser v0.10.1
Git commit:
Backend: QtWebEngine
CPython: 3.5.2
Qt: 5.8.0
PyQt: 5.8.2
phansch / screenshot_upload_to_s3.rb
Created May 17, 2017
Upload the latest screenshot to s3 and copy the URL to the clipboard using xclip
View screenshot_upload_to_s3.rb
bucket_name = 's3_bucket_name'
region = 's3_region'
images_dir = "#{Dir.home}/Pictures/screenshots/*"
newest_file = Dir.glob(images_dir).max_by { |f| File.mtime(f) }
filename = File.basename(newest_file)
cmd = "aws s3 cp #{newest_file} s3://#{bucket_name}/#{filename} --region #{region} --acl public-read"
phansch /
Last active May 28, 2020 — forked from chetan/
Improved YARD cheatsheet
phansch / .pryrc
Last active Aug 21, 2018
Colored Pry prompt including Rails environment and app name
View .pryrc
def formatted_env
case Rails.env
when 'production'
bold_upcased_env = Pry::Helpers::Text.bold(Rails.env.upcase)
when 'staging'
when 'development'
View association_testcase.rb
# Run with `ruby association_testcase.rb`
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
gemfile(true) do
source ""
You can’t perform that action at this time.