Skip to content

Instantly share code, notes, and snippets.

View madmax's full-sized avatar

Grzegorz Derebecki madmax

View GitHub Profile
var ImageResize = {
margin: 8,
parse: function(css_id, margin) {
if(margin) { this.margin = margin; }
$$('#' + css_id + ' img').each(function(img) {
this.resize(img, $(css_id).getWidth() - this.margin);
}, this);
},
class TopicWorker < Resque::JobWithStatus
#extend Resque::Plugins::Retry
#@retry_limit = 0
#@retry_delay = 60
@queue = :low
attr_accessor :options
def perform
self.options = options.reverse_merge(:until_time => Time.current).symbolize_keys
@madmax
madmax / gist:1474059
Created December 13, 2011 21:54
changing font in textmate 2
1. Open Bundle editor
2. Select Themes -> Themes -> your theme
3. add to settings
fontName = 'Monaco';
fontSize = '12px';
or what you want, enjoy :)
@madmax
madmax / assets.rake
Created June 10, 2012 16:17
Faster way to compile assets
require "fileutils"
namespace :assets do
namespace :precompile do
desc "Faster way to compile assets"
task fast: ["assets:environment", "tmp:cache:clear", "assets:precompile:primary"] do
config = Rails.application.config
if config.assets.digest
assets_path = File.join(Rails.public_path, config.assets.prefix)
manifest_path = config.assets.manifest || assets_path
set nocompatible
call pathogen#infect()
call pathogen#helptags()
syntax on
filetype plugin indent on
" swp to one directory outside project
" set backupdir=~/.vim/tmp,.
set nocompatible
call pathogen#infect()
call pathogen#helptags()
syntax on
filetype plugin indent on
" swp to one directory outside project
" set backupdir=~/.vim/tmp,.
set nocompatible
call pathogen#infect()
call pathogen#helptags()
syntax on
filetype plugin indent on
" swp to one directory outside project
" set backupdir=~/.vim/tmp,.
""" Code folding options
nmap <leader>0 :set foldlevel=0<CR>
nmap <leader>1 :set foldlevel=1<CR>
nmap <leader>2 :set foldlevel=2<CR>
nmap <leader>3 :set foldlevel=3<CR>
nmap <leader>4 :set foldlevel=4<CR>
nmap <leader>5 :set foldlevel=5<CR>
nmap <leader>6 :set foldlevel=6<CR>
nmap <leader>7 :set foldlevel=7<CR>
nmap <leader>8 :set foldlevel=8<CR>
#!/bin/bash
GITHUB_USER="madmax"
if [ "$1" != "" ]; then
echo "Merging pull request $1"
OUT=`basename $1`
curl --user $GITHUB_USER $1.patch > $OUT.patch
git am -s --3way --ignore-space-change $OUT.patch
rm $OUT.patch
else
@madmax
madmax / cache_key_test.rb
Created June 21, 2016 08:00
cache_key timestamp not calculated when using offset
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'