Skip to content

Instantly share code, notes, and snippets.

View cs3b's full-sized avatar

Michał Czyż cs3b

  • CS3B
  • Wisła, Poland
  • X @cs3b
View GitHub Profile
#! /bin/sh
### BEGIN INIT INFO
# Provides: mongodb
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the mongodb data-store
# Description: starts mongodb using start-stop-daemon
module Globalize
module ActiveRecord
class Adapter
# The cache caches attributes that already were looked up for read access.
# The stash keeps track of new or changed values that need to be saved.
attr_reader :record, :cache, :stash
def initialize(record)
@record = record
@cache = Attributes.new
@cs3b
cs3b / hp.mc
Created February 22, 2010 13:45
Nginx on Dev Machine
./configure --prefix='/opt/nginx' --with-pcre='/tmp/pcre-7.8' --add-module='/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/passenger-2.2.7/ext/nginx' --with-http_ssl_module --with-http_stub_status_module --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6RiwEkfpN5ci1SmwJFQ433TO0QsNyJL17FKUL0vXl7OfNNPxM7ye5b9FRfOmGxoIi2mpBbQ8q00aJXHxTRVspW1++MjKkwJjYSUNT9RR5qKcp2bBuN8bOIzpcyRlZPxqzhMoCC4BSE6na/zgJ5kAk9NWzXg0XrTP4ch55MCGP6VQoKhzXGyZ3e9MXSc/YonlQ+RM5mILqMAOqceKHAuuz19J5tjzLOFA1I9JgaH79nT9MFFOx3klqdcQr3hJz9iFjDrkxDwnHd59J00IvYiRBB8zaUea6bWDl4aaveCEEqAi37CABpSyM49n0FGh0ltwzKDpXuzVEv7W+hK3PVM+CQ== [email protected]
# model invoice
def store_pdf
# this should be constant
temp_invoice_file_path = Rails.root.join("html2pdf/invoice.html")
File.open(temp_invoice_file_path, 'w') {|f| f.write(markup) }
if ENV['OS'] and ENV['OS'].include?("Windows")
`xhtml2pdf html2pdf/invoice.html #{filepath}`
else
`python pisa.py #{temp_invoice_file_path} #{filepath}`
@cs3b
cs3b / hp
Created April 27, 2010 12:41
bind local
;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA localhost. root.localhost. (
3 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
rails_root = '/home/services/redmine'
rails_env = 'production'
unicorn_pid = '/home/services/redmine/tmp/pids/unicorn.pid'
group = user = 'services'
gemset = 'redmine'
God.watch do |w|
w.name = "redmine_unicorn"
w.group = "services"
w.interval = 30.seconds
@cs3b
cs3b / rspec-core_lib_rspec_core_example.rb
Created October 24, 2011 17:14
Patch for rspec runner - to handle firefox freezzing [ done in spirit of monkey see monkey path - use on your own risk :-)
module RSpec
module Core
class Example
def run(example_group_instance, reporter)
@example_group_instance = example_group_instance
@example_group_instance.example = self
start(reporter)
@cs3b
cs3b / selleo-template-rails-3.2.rb
Created May 2, 2012 11:50
rails 3.2 postgresql rspec factory-girl kameleon headless jasmine guard state_machine inherited_resources drapper devise cancan state-machine kaminari active_admin haml formtastic iconic
# Selleo Application Boostrap Template
# initial based on https://github.com/RailsApps/rails3-application-templates/raw/master/rails3-bootstrap-devise-cancan-template.rb
#
# In difference from original it's not customizable (at least ont interactive) - and it works with Rails 3.2 and above
# Usage: rails new APP_NAME -d postgresql -m https://raw.github.com/gist/2576043/44e01e55e68828f7d1dd996a5c9159a399249a42/selleo-template-rails-3.2.rb -T
# Information and a tutorial:
# https://github.com/RailsApps/rails3-bootstrap-devise-cancan
# Generated using the rails_apps_composer gem:
@cs3b
cs3b / speaker.md
Created June 25, 2012 14:00 — forked from matiaskorhonen/speaker.md
Frozen Rails Talk Proposal Template (http://2012.frozenrails.eu/)