Skip to content

Instantly share code, notes, and snippets.

module Modules
class OrderPdf
include ActionView::Rendering
def initialize(order)
@order = order
@view = ActionView::Base.new(ActionController::Base.view_paths, {})
@view.extend(ApplicationHelper)
@view.extend(AbstractController::Rendering)
@view.extend(Rails.application.routes.url_helpers)
@bogdanRada
bogdanRada / settings.rb
Created December 17, 2015 14:21 — forked from justinweiss/settings.rb
Simple settings for Rails
require 'yaml'
require 'erb'
require 'ostruct'
class Settings < OpenStruct
# Settings.new(:google_analytics)
def initialize(config_file_base_name)
super(YAML.load(ERB.new(File.read(Rails.root.join("config", "#{config_file_base_name}.yml"))).result)[Rails.env])
end
@bogdanRada
bogdanRada / .gitignore
Created November 2, 2015 08:44 — forked from thesp0nge/.gitignore
A skelethon for a web crawler for the Codesake suite
*.db
*.swp
@bogdanRada
bogdanRada / build.xml
Created October 13, 2015 09:13 — forked from yogendra/build.xml
Simple Ant Build Script for Eclipse Dynamic Web Project #java #ant #snippet
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="package" name="PROJECT_NAME">
<!--
This script assumes:
1) CATALINA_HOME environment variable points to tomcat's directory
2) Following Folder Structure
./ (project root)
|- src/ (project.src.dir - source folder)
|- build/
| |- classes/ (project.classes.dir)
@bogdanRada
bogdanRada / Gruntfile.js
Created October 8, 2015 16:14 — forked from booleanbetrayal/Gruntfile.js
Example GruntJS configuration for a replacement to the Sprockets Rails asset pipeline
'use strict';
module.exports = function(grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// configurable paths
var paths = {
@bogdanRada
bogdanRada / _message.html.erb
Last active September 10, 2015 07:13 — forked from Joseph-N/_message.html.erb
Tutorial code snippets for chat application in rails. Tutorial link http://goo.gl/l3e8zN
<li class="<%= self_or_other(message) %>">
<div class="avatar">
<img src="http://placehold.it/50x50" />
</div>
<div class="chatboxmessagecontent">
<p><%= message.body %></p>
<time datetime="<%= message.created_at %>" title="<%= message.created_at.strftime("%d %b %Y at %I:%M%p") %>">
<%= message_interlocutor(message).name %> • <%= message.created_at.strftime("%H:%M %p") %>
</time>
</div>
@bogdanRada
bogdanRada / event.rb
Last active August 29, 2015 14:27 — forked from AstDerek/event.rb
Simple Rails app compatible with DHTMLX Scheduler http://www.dhtmlx.com/docs/products/dhtmlxScheduler/index.shtml
class Event < ActiveRecord::Base
attr_accessible :_timed, :details, :end_date, :start_date, :text
# From http://www.dhtmlx.com/docs/products/dhtmlxScheduler/xml/events.xml
def to_xml (options = {})
options[:indent] ||= 2
xml = options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent])
xml.instruct! unless options[:skip_instruct]
xml.event(:id => id, :timed => _timed) do
xml.text text
#!/bin/bash
sudo apt-get update
# Install Basics
# build-essential needed for "make" command
sudo apt-get install -y build-essential software-properties-common \
vim curl wget tmux
# Install PHP 5.6
sudo add-apt-repository -y ppa:ondrej/php5-5.6
@bogdanRada
bogdanRada / rack_spellcheck.rb
Last active August 31, 2015 09:30 — forked from techiferous/gist:235097
rack_spellcheck.rb
# If you'd like this packaged up as a gem, send me a note. You can get
# in touch with me at http://www.techiferous.com/about
require 'nokogiri'
require 'ispell'
module Rack
class SpellCheck
def initialize(app, options = {})
module Rack
# A rack middleware for validating HTML via w3c validator
class Validate
def initialize( app )
@app = app
end
def call( env )