Skip to content

Instantly share code, notes, and snippets.

View phansch's full-sized avatar
Resuming OSS work

Phil Hansch phansch

Resuming OSS work
View GitHub Profile
@phansch
phansch / stuck.rb
Created November 27, 2017 11:05
Debugging stuck Ruby processes
# 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: #{Process.pid}"
trap 'USR1' do
threads = Thread.list
puts
puts "=" * 80
puts "Received USR1 signal; printing all #{threads.count} thread backtraces."
@phansch
phansch / GitHub.PowerShell_profile.ps1
Created October 1, 2012 19:25
My custom PowerShell prompt
function shorten-path([string] $path) {
$loc = $path.Replace($HOME, '~')
# remove prefix for UNC paths
$loc = $loc -replace '^[^:]+::', ''
# make path shorter like tabs in Vim,
# handle paths starting with \\ and . correctly
return ($loc -replace '\\(\.?)([^\\])[^\\]*(?=\\)','\$1$2')
}
function prompt {
@phansch
phansch / .pryrc
Last active August 21, 2018 11:30
Colored Pry prompt including Rails environment and app name
def formatted_env
case Rails.env
when 'production'
bold_upcased_env = Pry::Helpers::Text.bold(Rails.env.upcase)
Pry::Helpers::Text.red(bold_upcased_env)
when 'staging'
Pry::Helpers::Text.yellow(Rails.env)
when 'development'
Pry::Helpers::Text.green(Rails.env)
else
@phansch
phansch / Dockerfile
Last active October 28, 2018 12:02
Trying to reproduce a 32bit Clippy crash https://github.com/rust-lang-nursery/rust-clippy/issues/3345
FROM i386/buildpack-deps:stretch
# The rustup installation code is taken from https://github.com/rust-lang-nursery/docker-rust/blob/master/1.30.0/stretch/Dockerfile
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=1.30.0
RUN set -eux; \
diff --git a/tests/ui/auxiliary/macro_rules.rs b/tests/ui/auxiliary/macro_rules.rs
index 486e419b..2d8d571d 100644
--- a/tests/ui/auxiliary/macro_rules.rs
+++ b/tests/ui/auxiliary/macro_rules.rs
@@ -7,3 +7,9 @@ macro_rules! foofoo {
loop {}
};
}
+
+macro_rules! must_use_unit {
@phansch
phansch / app.js
Last active June 2, 2020 19:26
vue-tables-2 pagination on top and bottom
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
phansch / yardoc_cheatsheet.md
Last active March 1, 2024 18:17 — forked from chetan/yardoc_cheatsheet.md
Improved YARD cheatsheet