Skip to content

Instantly share code, notes, and snippets.

@jakimowicz
jakimowicz / the % notation in ruby.md
Last active April 4, 2024 13:59
%Q, %q, %W, %w, %x, %r, %s, %I, %i

%Q, %q, %W, %w, %x, %r, %s, %i

Perl-inspired notation to quote strings: by using % (percent character) and specifying a delimiting character.

Any single non-alpha-numeric character can be used as the delimiter, %[including these], %?or these?, %~or even these things~.

Strings

% or %Q

@jakimowicz
jakimowicz / redmine gitlab sync
Created November 15, 2012 16:22
simple (and dirty) sync between redmine issues and gitlab issues
#!/usr/bin/env ruby
require 'faraday'
require 'json'
require 'gitlab'
module Redmine
Host = nil
APIKey = nil
#!/usr/bin/env ruby
# by Helder Ribeiro 2009
# by Fabien Jakimowicz 2010
#
# Plugin to monitor delayed_jobs' queue size
# Gives updates with number of jobs that haven't been started yet
# plus the ones that failed and are still rescheduled for another run
#
# Parameters supported:
#

Keybase proof

I hereby claim:

  • I am jakimowicz on github.
  • I am fabienj (https://keybase.io/fabienj) on keybase.
  • I have a public key ASByKnw5AnNkQo_niieSOPGHqHRIFvLnq7IBvQlsYEEEUQo

To claim this, I am signing this object:

@jakimowicz
jakimowicz / mongo_mapper.rb
Last active December 26, 2015 21:39 — forked from bhbryant/retry.rb
auto-failover ReplicaSet config for MongoMapper, by way of ruby driver. without any change to the connection. You just need to require the files before initiating the connection.
require 'lib/mongo/retry'
require 'lib/mongo/repl_set_connection'
#!/usr/bin/env ruby
def output_config
puts <<-END
graph_category passenger
graph_title rails processes memory
graph_vlabel megabytes
graph_info This graph shows the average, min and max memory consumption made by rails processes.
graph_order max average min
max.label max
#!/usr/bin/env ruby
def output_config
puts <<-END
graph_category passenger
graph_title memory
graph_vlabel megabytes
graph_info This graph shows the memory consumption made by passenger processes, passenger and nginx.
graph_order nginx passenger rails
rails.label rails
#!/usr/bin/env ruby
def output_config
puts <<-END
graph_category passenger
graph_title status
graph_vlabel count
graph_info This graph shows how much passenger process are working, available and how much queries are waiting.
max.label max processes
max.draw AREA