Skip to content

Instantly share code, notes, and snippets.

View zaiste's full-sized avatar
🌀
Loading...

Jakub Neander zaiste

🌀
Loading...
View GitHub Profile
file 'Gemfile', <<-GEMS
source 'http://gemcutter.org'
gem "rails", "3.0.0.rc2"
gem "bson_ext", '1.0.4'
gem "mongoid", "2.0.0.beta.17"
gem "compass", "0.10.5"
group :development, :test do
gem "rspec-rails", "2.0.0.beta.20"
gem "capybara"
@zaiste
zaiste / gist:846659
Created February 27, 2011 22:57
'git push heroku master' Error
Installing migration_assist (0.1.9) /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/specification.rb:1050:in `ruby_code': ruby_code case not handled: Syck::PrivateType (Gem::Exception)
@zaiste
zaiste / none.rb
Created September 11, 2011 16:36
Just trying
class Bastard
def punch
end
end
@zaiste
zaiste / gist:1226279
Created September 19, 2011 10:42
Google Analytics in HAML
- domain = @config[:ganalytics][:domain]
- site_id = @config[:ganalytics][:site_id]
- if site_id
:javascript
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
:javascript
try {
var pageTracker = _gat._getTracker("#{site_id}");
pageTracker._setDomainName(".#{domain}");
require 'active_support/basic_object'
ActiveRecord::Base.class_eval do
class WithoutCallbacks < ActiveSupport::BasicObject
def initialize(target, types)
@target = target
@types = types
end
def respond_to?(method, include_private = false)
@zaiste
zaiste / simple_form.rb
Created February 11, 2012 17:06 — forked from oma/simple_form.rb
rails 3.2 simple_form-2.0 twitter bootstrap
SimpleForm.setup do |config|
# Wrappers are used by the form builder to generate a complete input.
# You can remove any component from the wrapper, change the order or even
# add your own to the stack. The options given to the wrappers method
# are used to wrap the whole input (if any exists).
config.wrappers :bootstrap, :tag => 'fieldset', :class => 'control-group', :error_class => 'error' do |b|
b.use :placeholder
b.use :label, :class => 'control-label'
b.use :tag => 'div', :class => 'controls' do |ba|
ba.use :input
@zaiste
zaiste / post.rb
Created March 13, 2012 23:43
Blog Post using Nanoc command
usage 'create:post [options]'
aliases :cp
summary 'create a new blog post'
description ''
flag :h, :help, 'show help for this command' do |value, cmd|
puts cmd.help
exit 0
end
@zaiste
zaiste / nginx_virtual_host
Created March 28, 2012 00:22 — forked from mrsweaters/nginx_virtual_host
Ruby on Rails server setup on Ubuntu 11.04 with Nginx, Unicorn, Rbenv
upstream example-workers {
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response (in case the Unicorn master nukes a single worker for timing out).
server unix:/tmp/example.co.uk.socket fail_timeout=0;
}
server {
listen 80; # default;
server_name example.co.uk;
root /home/example.co.uk/website/public;
@zaiste
zaiste / _form.html.haml
Created March 28, 2012 12:45 — forked from mhenrixon/_form.html.haml
A complete sample of how to perform nested polymorphic uploads in rails using carrierwave
=semantic_form_for [:admin, @dog], validate: true, html: {multipart: true} do |f|
=f.inputs do
=f.input :name
=f.input :kennel_name
=f.input :birthdate
=f.input :gender, as: :radio, collection: {'Tik' => 'F', 'Hane' => 'M'}
=f.input :father_id, as: :select, collection: @dogs
=f.input :mother_id, as: :select, collection: @bitches
=f.semantic_fields_for :pictures do |pic|
@zaiste
zaiste / nginx.conf
Created March 29, 2012 17:51
nginx + unicorn + vhost
upstream unicorn {
server unix:/tmp/unicorn.app_name.sock fail_timeout=0;
}
server {
listen 80 default deferred;
server_name apps.company.com/app_name/;
root /home/deployer/apps/app_name/current/public;
location ^~ /assets/ {