Skip to content

Instantly share code, notes, and snippets.

View konung's full-sized avatar
๐Ÿ’ญ
๐Ÿ’™๐Ÿ’›

Nick Gorbikoff konung

๐Ÿ’ญ
๐Ÿ’™๐Ÿ’›
View GitHub Profile
class ApplicationController < ActionController::Base
include Trailblazer::Operation::Controller
respond_to :html, :json, :xml
#....
end
# app/concepts/layout/cell.rb
class Layout::Cell < Cell::App
def show
render
@konung
konung / Rakefile
Last active August 29, 2015 14:18 — forked from robhurring/Rakefile
task :environment do
require './dj-sinatra'
end
namespace :jobs do
desc "Clear the delayed_job queue."
task :clear => :environment do
Delayed::Job.delete_all
end
@konung
konung / gist:5923387
Last active December 19, 2015 08:09
Find most recently modified ( last modified) file or directory using Ruby's FileUtils. Extends FileUtils
module FileUtils
def sorted_by_modified_files(path='.',extension_filter = "")
Dir.open(path).entries.map do |f|
[f,File.mtime(File.join(path,f))]
end.sort_by do |a|
a[1]
end.delete_if do |a|
File.stat(File.join(path,a[0])).directory? or
a[0] == '.' or a[0] == '..' or a[0].match(/#{extension_filter}$/).nil?
end
# Update, upgrade and install development tools:
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install build-essential git-core curl libssl-dev \
libreadline5 libreadline5-dev \
zlib1g zlib1g-dev \
libmysqlclient-dev \
libcurl4-openssl-dev \
libxslt-dev libxml2-dev
@konung
konung / README.md
Created February 3, 2012 04:32 — forked from fnichol/README.md
Download a cacert.pem for RailsInstaller

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)

class CreateContactAttempts < ActiveRecord::Migration
def self.up
create_table :contact_attempts do |t|
t.string :first_name
t.string :last_name
t.string :email
t.string :url
t.string :company
t.text :message_body