Skip to content

Instantly share code, notes, and snippets.

@pikhovkin
pikhovkin / weasyprint_complex_headers.py
Last active February 3, 2024 17:04
Repeat on each page of complex headers (eg, tables) except the first page
# coding: utf-8
from weasyprint import HTML, CSS
def get_page_body(boxes):
for box in boxes:
if box.element_tag == 'body':
return box
@dariocravero
dariocravero / todo.md
Last active December 10, 2015 18:29
Padrino Admin's todo list

Todo list

  • Implement delete selected (@dariocravero).
  • Fix issue with delete popover's positioning on FF (@dariocravero).
  • Put the footer always to the bottom of the page (@waydotnet).
  • Upgrade to bootstrap's v3 (@waydotnet).
  • Implement I18n.
  • ...?
authorization do
role :guest do
has_permission_on :users, :to => :create
end
role :user do
includes :guest
has_permission_on :users, :to => :manage do
if_attribute :id => is {user.id}
end
@MicahChalmer
MicahChalmer / .htaccess
Last active May 1, 2016 16:49
Scripts to set up Ruby 1.9.3 on a DreamHost shared hosting account via rbenv and ruby-build, and run a Rack app with it via FastCGI.
<IfModule mod_fastcgi.c>
AddHandler fastcgi-script .fcgi
</IfModule>
<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi
</IfModule>
Options +FollowSymLinks +ExecCGI
RewriteEngine On
@k2052
k2052 / emacsCoreCommands.md
Created November 16, 2012 18:45
Emacs Shortcuts + Commands

Emacs Commands

Text

  • C-f: move cursor forward one char
  • C-b: mover cursor back one chart
  • C-n: mover cursor to next line
  • C-p: go to previous line
  • M-f: forward one word
  • M-b: move backward one word
@vinhnx
vinhnx / app.rb
Created August 12, 2012 07:25
Twit Buddy app.rb
#init
require 'rubygems'
require 'twitter'
require 'sinatra'
require 'haml'
# Twitter auth
Twitter.configure do |config|
config.consumer_key = 'xxxxxx'
config.consumer_secret = 'xxxxxx'
@awesome
awesome / sticky.css
Created July 24, 2012 08:55 — forked from mokagio/sticky.css
Twitter Bootstrap + Sticky Footer + Fixed Nav Bar
html, body, .container, .content {
height: 100%;
}
.container, .content {
position: relative;
}
.proper-content {
padding-top: 40px; /* >= navbar height */
@johan
johan / jquery.naturalWidth.js
Created March 26, 2012 21:40
jQuery.naturalWidth / jQuery.naturalHeight plugin for (already-loaded) images
// jQuery.naturalWidth / jQuery.naturalHeight plugin for (already-loaded) images
// Triple-licensed: Public Domain, MIT and WTFPL license - share and enjoy!
(function($) {
function img(url) {
var i = new Image;
i.src = url;
return i;
}
@DAddYE
DAddYE / image_uploader.rb
Created December 30, 2011 22:57
CarrierWave on the fly resizer (work as dragonfly)
class ImageUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
storage :file
def thumb(size)
begun_at = Time.now
size.gsub!(/#/, '!')
uploader = Class.new(self.class)
uploader.versions.clear
uploader.version_names = [size]
@wisq
wisq / gist:1507733
Created December 21, 2011 21:14
Why I love zsh (and hate being forced to use bash)

Why I love zsh (and hate being forced to use bash)

  • Smarter completion. A few examples:
  • context sensitive -- if you have file "name1" and directory "name2", "cd nam<TAB>" completes to "name2/"
  • "tar xf <TAB>" completes to tarballs only. "unrar x <TAB>" completes to RARs only. etc.
  • rsync / scp completion: "rsync host:anything/<TAB>" shows you files on host under anything/
  • also works with rsync:// URLs
  • SSH host completion from ~/.ssh/config & ~/.ssh/known_hosts
  • lots of other smart completions: Rake tasks, git commands & SHAs, dpkg packages, dash-options for most commands, etc etc.