Skip to content

Instantly share code, notes, and snippets.

View jmlacroix's full-sized avatar

Jean-Michel Lacroix jmlacroix

View GitHub Profile
with table_stats as (
select psut.relname,
psut.n_live_tup,
1.0 * psut.idx_scan / greatest(1, psut.seq_scan + psut.idx_scan) as index_use_ratio
from pg_stat_user_tables psut
order by psut.n_live_tup desc
),
table_io as (
select psiut.relname,
sum(psiut.heap_blks_read) as table_page_read,
@yjaaidi
yjaaidi / gist:9488069
Created March 11, 2014 15:23
OS X - Change Chrome Language
defaults write com.google.Chrome AppleLanguages '(en-US)'
@seyhunak
seyhunak / mini_magick.rb
Created September 9, 2013 13:30
How to add a text caption to an image with MiniMagick and Ruby
require 'rubygems'
require 'mini_magick'
img = MiniMagick::Image.from_file("jpeg.jpg")
img.combine_options do |c|
c.gravity 'Southwest'
c.draw 'text 10,10 "whatever"'
c.font '-*-helvetica-*-r-*-*-18-*-*-*-*-*-*-2'
c.fill("#FFFFFF")
end
@paulkaplan
paulkaplan / retina_fabric.js
Created July 21, 2013 22:47
Getting fabric.js to work with Retina screens
if( window.devicePixelRatio !== 1 ){
var c = canvas.getElement(); // canvas = fabric.Canvas
var w = c.width, h = c.height;
// Scale the canvas up by two for retina
// just like for an image
c.setAttribute('width', w*window.devicePixelRatio);
c.setAttribute('height', h*window.devicePixelRatio);
@elvuel
elvuel / text_shadow_spike.rb
Created November 12, 2012 03:25
Using mini_magick(IM) draw text with shadow effect
# encoding: utf-8
require 'mini_magick'
image = MiniMagick::Image.open('blank.jpg')
image.combine_options do |c|
c.gravity 'Center'
c.pointsize '22'
c.draw "text 3,3 'Ruby'"
c.fill 'blue'
c.draw "text 0,0 'Ruby'"
c.fill 'gray'