Skip to content

Instantly share code, notes, and snippets.

View minikomi's full-sized avatar
🍕
I like pizza

Adam Moore minikomi

🍕
I like pizza
View GitHub Profile
@minikomi
minikomi / gist:1148832
Created August 16, 2011 10:42
Padrino Pagination w/ params for good.
We couldn’t find that file to show.
@minikomi
minikomi / gist:1151177
Created August 17, 2011 09:27
will_paginate renderer not specified on padrino in view
ArgumentError - :renderer not specified:
/Users/Adam/.rvm/gems/ruby-1.9.2-p180/bundler/gems/will_paginate-dc588e6b5b6f/lib/will_paginate/view_helpers.rb:79:in `will_paginate'
/Users/Adam/fashion-p/app/views/shared/_brand_list.html.haml:9:in `evaluate_source'
/Users/Adam/.rvm/gems/ruby-1.9.2-p180/gems/tilt-1.3.2/lib/tilt/template.rb:209:in `instance_eval'
/Users/Adam/.rvm/gems/ruby-1.9.2-p180/gems/tilt-1.3.2/lib/tilt/template.rb:209:in `evaluate_source'
/Users/Adam/.rvm/gems/ruby-1.9.2-p180/gems/tilt-1.3.2/lib/tilt/template.rb:144:in `cached_evaluate'
/Users/Adam/.rvm/gems/ruby-1.9.2-p180/gems/tilt-1.3.2/lib/tilt/template.rb:127:in `evaluate'
/Users/Adam/.rvm/gems/ruby-1.9.2-p180/gems/tilt-1.3.2/lib/tilt/haml.rb:24:in `evaluate'
/Users/Adam/.rvm/gems/ruby-1.9.2-p180/gems/tilt-1.3.2/lib/tilt/template.rb:76:in `render'
/Users/Adam/.rvm/gems/ruby-1.9.2-p180/gems/sinatra-1.2.6/lib/sinatra/base.rb:563:in `render'
@minikomi
minikomi / gist:1153616
Created August 18, 2011 07:57
Japanese fonts
font-family: "ヒラギノ角ゴ Pro W3","Hiragino Kaku Gothic Pro"
font-family: "ヒラギノ角ゴ ProN W3","Hiragino Kaku Gothic ProN"
font-family: "ヒラギノ角ゴ Pro W6","HiraKakuPro-W6"
font-family: "ヒラギノ角ゴ ProN W6","HiraKakuProN-W6"
font-family: "ヒラギノ角ゴ Std W8","Hiragino Kaku Gothic Std"
@minikomi
minikomi / gist:1153760
Created August 18, 2011 09:47
Monkey patch padrino partial renderer to tell when partials are rendered
module Padrino
module Helpers
module RenderHelpers
##
# Partials implementation which includes collections support
#
# ==== Examples
#
# partial 'photo/item', :object => @photo
# partial 'photo/item', :collection => @photos
@minikomi
minikomi / gist:1200257
Created September 7, 2011 10:45
scenario / do wrap macro
let @s='^iscenario "^[A" do^[o^Mend^[V<Up><Up>^[='
@minikomi
minikomi / app.rb
Created October 4, 2011 06:50
Eliminiate flash[:notice] or flash[:errors] being shown on back button by forcing non-cache of page
before do
if flash[:notice] || flash[:errors]
response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
response.headers["Pragma"] = "no-cache"
response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
end
end
@minikomi
minikomi / spaceless_link.haml
Created October 7, 2011 07:56
Prevent spaces caused by unwanted carriage returns when using Haml in Japanese
@minikomi
minikomi / sqlinsert.rb
Created October 12, 2011 08:02
Inserting multiple rows at once into SQLite3 using raw SQL
# values_to_insert is an array of type
# [
# [val1.1, val1.2]
# [val2.1, val2.2],
# [val3.1, val3.2],
# ...etc
# ]
sql = ActiveRecord::Base.connection
@minikomi
minikomi / mobilehtml5.haml
Created October 12, 2011 09:55
mobile html5 boilerplate haml
<!doctype html>
/ Conditional comment for mobile ie7 http://blogs.msdn.com/b/iemobile/
/[if IEMobile 7 ] <html class="no-js iem7">
/ [if (gt IEMobile 7)|!(IEMobile)]><!
%html.no-js
/ <![endif]
%head
%meta{:charset => "utf-8"}
%title
%meta{:content => "", :name => "description"}
@minikomi
minikomi / caching.py
Created November 1, 2011 08:28
Start of file caching decorator for brubeck
###
### filecache decorator for static storage of rendered templates
###
def filecache(expires=60):
# Set time in seconds to keep file around.
# Default is 60 (1 min).
def decorator(method):
@functools.wraps(method)
def wrapper(self, *args, **kwargs):