Skip to content

Instantly share code, notes, and snippets.

View penso's full-sized avatar

Fabien Penso penso

View GitHub Profile
@devinus
devinus / gist:415179
Created May 26, 2010 22:38
Turn CSS rules into inline style attributes using jQuery
(function ($) {
var rules = document.styleSheets[document.styleSheets.length-1].cssRules;
for (var idx = 0, len = rules.length; idx < len; idx++) {
$(rules[idx].selectorText).each(function (i, elem) {
elem.style.cssText += rules[idx].style.cssText;
});
}
$('style').remove();
$('script').remove();
})(jQuery);
Push 3.0 was one of my favorite apps on my touch and one of the biggest dissapointments with moving to Android. It works flawlessly and is deceptively useful. I caught the unlimited unlock on sale and it was worth every penny. Pricing makes sense, although it wasnt explained well in the description at the time, I had to read comments for clarification.
That said, my one and only suggestion for improvement is: MAKE AN ANDROID VERSION, PLZ! Froyo 2.2 is bringing push to the OS and Push 3.0 would make an excellent flagship addition.
Is an Android adaptation in the works? Looking forward to buying the full unlocked version the day it hits the Droid Market.
Thanks
Sent from Samsung mobile
@timurvafin
timurvafin / Gemfile
Created October 13, 2012 07:49
Get http requests benchmark: sync vs. celluloid vs. em
source :rubygems
gem 'celluloid'
gem 'em-synchrony'
gem 'em-http-request'
@13k
13k / sidekiq_scheduling.rb
Last active March 31, 2016 18:02
low-level sidekiq scheduling helpers
# reschedule a known job
# i: job index
# soon: reschedule time
def reschedule(i=0, soon=1.minute.from_now)
# black magic
Sidekiq.redis do |r|
m = r.zrange('schedule', i, i).first
j = JSON.parse(m)
j['at'] = soon.to_f
r.zrem('schedule', m)
@oivoodoo
oivoodoo / routes.rake
Created March 5, 2013 10:06
rake task for printing grape routes.
namespace :grape do
desc 'Print compiled grape routes'
task :routes => :environment do
API.routes.each do |route|
puts route
end
end
end
@cobusc
cobusc / s3_log_analysis.sh
Created August 5, 2013 06:54
S3 log analysis using webalizer
#!/bin/bash
S3_LOG_LOCATION="s3://thelogbucket/logdir"
LOCAL_LOG_LOCATION="/tmp/log/"
REPORT_TITLE="My report title"
HTML_OUTPUT_DIR="/tmp/reporthtml"
REPORT="/tmp/report.ps"
# Sync log files to a local directory
s3cmd -v sync ${S3_LOG_LOCATION} ${LOCAL_LOG_LOCATION}
@sudara
sudara / puma.monitrc
Last active November 3, 2023 12:03
Example config needed to use monit with puma, monitoring workers for mem.
# this monit config goes in /etc/monit/conf.d
check process puma_master
with pidfile /data/myapp/current/tmp/puma.pid
start program = "/etc/monit/scripts/puma start"
stop program = "/etc/monit/scripts/puma stop"
group myapp
check process puma_worker_0
with pidfile /data/myapp/current/tmp/puma_worker_0.pid
@ball-hayden
ball-hayden / README.md
Last active September 21, 2018 09:07
ActiveAdmin Bootstrap

ActiveAdmin Bootstrap

This is a rough proof of concept.

There will be broken things.

Comments are welcome.

Installation

@mbbx6spp
mbbx6spp / README.md
Last active December 21, 2023 05:05
Gerrit vs Github for code review and codebase management

Gerrit vs Github: for code review and codebase management

Sure, Github wins on the UI. Hands down. But, despite my initial annoyance with Gerrit when I first started using it almost a year ago, I am now a convert. Fully. Let me tell you why.

Note: This is an opinionated (on purpose) piece. I assume your preferences are like mine on certain ideas, such as:

  • Fast-forward submits to the target branch are better than allowing merge commits to the target branch. The reason I personally prefer this is that, even if a non-conflicting merge to the target branch is possible, the fact that the review/pull request is not up to date with the latest on the target branch means feature branch test suite runs in the CI pipeline reporting on the review/PR may not be accurate. Another minor point is that forced merge commits are annoying as fuck (opinion) and clutter up Git log histories unnecessarily and I prefer clean histories.
  • Atomic/related changes all in one commit is something worth striving for. Having your dev
#!/usr/bin/env bash
size=1024 # MB
mount_point=$HOME/tmp
name=$(basename "$mount_point")
usage() {
echo "usage: $(basename "$0") [mount | umount | remount | check | orphan]" \
"(default: mount)" >&2
}