Skip to content

Instantly share code, notes, and snippets.

Julien Letessier mezis

Block or report user

Report or block mezis

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
@mezis
mezis / git-merge-po.sh
Last active Jan 10, 2019
Git merge driver for PO files
View git-merge-po.sh
#!/bin/sh
#
# *******************************************
# WARNING: this does *not* handle 3-way merges properly.
# Anything modified on the local branch since the common base will get ignored.
#
# FOR ANYONE LANDING HERE:
# This script is now updated as part of the git-whistles gem.
# https://github.com/mezis/git-whistles
# *******************************************
@mezis
mezis / git-list-branches.sh
Created Jan 19, 2012
List all remote local or branches in your repo, along with colourful freshness information!
View git-list-branches.sh
#!/bin/bash
#
# List branch status and age against an integration branch.
#
# Copyright (C) 2012 Julien Letessier
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
@mezis
mezis / git-chop.sh
Created Feb 9, 2012
Close a feature branch - removing it from local and remote
View git-chop.sh
#!/bin/bash
#
# Close a feature branch - removing it from local and remote.
#
die() {
echo "$@" ; exit 1
}
head=$(git symbolic-ref HEAD 2> /dev/null || git log -1 --format=%h)
View gist:2780719
diff --git a/lib/tasks/gettext_rails.rake b/lib/tasks/gettext_rails.rake
index 28da8a4..ce63757 100644
--- a/lib/tasks/gettext_rails.rake
+++ b/lib/tasks/gettext_rails.rake
@@ -3,7 +3,10 @@ namespace :gettext do
task :updatepo do
require 'gettext_rails/tools'
require 'preprocessing_erb_parser'
- GetText.update_pofiles("housetrip", Dir.glob("{app,lib,assets}/**/*.{rb,erb,rjs}").sort, "housetrip 1.0.0")
+ paths = Dir.glob("{app,lib,assets}/**/*.{rb,erb,rjs}").reject { |path|
View gist:3550134
diff --git a/app/models/booking/messaging_trait.rb b/app/models/booking/messaging_trait.rb
index 7bec914..355cc0f 100644
--- a/app/models/booking/messaging_trait.rb
+++ b/app/models/booking/messaging_trait.rb
@@ -82,7 +82,7 @@ module Booking::MessagingTrait
self.host_conversation.all_messages.detect{|m| m.is_a?(Message::WithGuestBooking)}
guest_message = self.tenant_info_sheet.andand.message
- if guest_message && !created_already
+ if guest_message.present? && !created_already
View bm_dci_pounding.rb
require 'benchmark'
number_of_rails_methods = 300
@rails = Class.new do
number_of_rails_methods.times do |i|
class_eval <<-RUBY
def call#{"%02d" % i} # def call01
end # end
RUBY
@mezis
mezis / gist:6967407
Created Oct 13, 2013
Rubinius 2.0.0 with RBenv + ruby-build plugin
View gist:6967407
# in ~/.rbenv/rbenv.d/rehash/rbx-2.0.0.bash
make_shims "~/.rbenv/versions/rbx-2.0.0/gems/bin/*"
# in ~/.rbenv/rbenv.d/which/rbx-2.0.0.bash
if [ ! -x "$RBENV_COMMAND_PATH" ] && [[ $RBENV_VERSION =~ rbx-2 ]]; then
export RBENV_COMMAND_PATH="${RBENV_ROOT}/versions/${RBENV_VERSION}/gems/bin/${RBENV_COMMAND}"
fi
View he
#!/usr/bin/env ruby
#
# Heroku wrapper
#
require 'pathname'
app_basename = Pathname.new('.').realpath.basename.to_s
head_name = %x(git symbolic-ref HEAD).strip
branch_name = head_name.gsub(%r(^refs/heads/), '')
@mezis
mezis / deploy.rb.diff
Created Jan 21, 2014
Restart servers in a staggered manner.
View deploy.rb.diff
diff --git i/config/deploy.rb w/config/deploy.rb
index 73fc910..594322c 100644
--- i/config/deploy.rb
+++ w/config/deploy.rb
@@ -65,7 +65,7 @@ end
desc 'restart'
deploy.task :restart, :roles => :web do
- run "touch #{current_path}/tmp/restart.txt"
+ run "bash -c 'sleep $(( $RANDOM / 100 ))' ; date ; touch #{current_path}/tmp/restart.txt"
@mezis
mezis / query_finder.sql
Last active Sep 24, 2019
Finding long-running queries in MySQL
View query_finder.sql
SELECT id,state,command,time,left(replace(info,'\n','<lf>'),120)
FROM information_schema.processlist
WHERE command <> 'Sleep'
AND info NOT LIKE '%PROCESSLIST%'
ORDER BY time DESC LIMIT 50;
You can’t perform that action at this time.