Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash -ex
FLIGHT_APPLIANCE_MENU_BRANCH=dev/vpn
FLIGHT_GUI_BRANCH=master
########Base Packages###########
yum -y install patch autoconf automake bison bzip2 gcc-c++ libffi-devel libtool \
patch readline-devel ruby sqlite-devel zlib-devel glibc-headers glibc-devel openssl-devel make unzip wget git
yum -y install epel-release
yum -y install openvpn easy-rsa bind-utils
require "zlib"
require "stringio"
require "time" # for Time.httpdate
require 'rack/utils'
module Hardwired
class Deflater
DEFAULT_CONTENT_TYPES =
[
@mjtko
mjtko / howto.md
Created November 2, 2012 18:56 — forked from goosetav/howto.md
prevent ttf fonts while running poltergeist

RE: teampoltergeist/poltergeist#44

Use Rack::SimpleEndpoint to prevent Poltergeist/PhantomJS from crashing on TTF fonts.

Create config/initializers/middleware-deny-ttf-to-phantomjs-under-test.rb:

if Rails.env.test?
  require 'rack/contrib/simple_endpoint'
 Rails.application.config.middleware.insert_after Rack::Runtime, Rack::SimpleEndpoint, /\.ttf$/ do |req, res|
class Contact < ActiveRecord::Base
validates :dob, :presence => true, :if => :is_patient?
validates :contact_type_id, :first_name, :last_name, :presence => true
has_many :calls
belongs_to :contact_type
def is_patient?
@mjtko
mjtko / location.rb
Created February 12, 2012 19:06 — forked from drale2k/gist:1810253
class Location < ActiveRecord::Base
DEFAULT_OPTS = {:units => :km}
class << self
def near(coords, radius = 10, opts = {})
options = DEFAULT_OPTS.merge(options)
radius = radius.to_i
# do stuff with coords and radius and options
end
end
<ul class="photos">
<% @album.photos.in_groups_of(20, false) do |photos| %>
<div class="slide">
<% photos.each do |photo| %>
<li class="photo">
<%= link_to image_tag(photo.source(:square)), photo.source(:large), rel: 'gallery', class: 'fancybox-thumb' %>
</li>
<% end %>
</div>
<% end %>
@mjtko
mjtko / gist:1354648
Created November 10, 2011 11:26 — forked from stuffness/gist:1354646
Different database adapters... per platform ;)
source 'http://rubygems.org'
gem 'rails', '3.1.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'mysql2', :platforms => :ruby # causes this gem to be skipped on windows
namespace :wtp do
namespace :jsroutes do
desc "Regenerate routes for users"
task :users do
puts "Recreating routes for users..."
JsRoutes.generate!({})
end
end
end
<%= simple_form_for([@pacient, @retetum]) do |f| %>
<%= f.error_notification %>
<div class="inputs">
<%= f.input :data %>
<%= f.input :cantitate %>
<%= f.input :serie %>
<%= f.input :medicamente_id do %>
<%# select(:retetum, :medicamente_id, Medicamente.pastile) %>
<%= select(:retetum, :medicamente_id, Medicamente.clase,
@mjtko
mjtko / error.rb
Created September 2, 2011 20:06
error.rb
# app/models/kebab.rb
module Kebab
class << self
def table_name_prefix
'kebab_'
end
end
end
# app/models/kebab/user.rb -- should work now