Skip to content

Instantly share code, notes, and snippets.

View wojtha's full-sized avatar

Vojtěch Kusý wojtha

View GitHub Profile
@wojtha
wojtha / .ruby-version
Created March 2, 2016 15:57 — forked from heygrady/.ruby-version
Example setup for running Unicorn on Ubuntu to manage Sinatra applications.
2.0.0@mygemset
@wojtha
wojtha / nginx.conf
Created October 1, 2015 14:40 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048

YARD CHEATSHEET http://yardoc.org

cribbed from http://pastebin.com/xgzeAmBn

Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.

Modules

Namespace for classes and modules that handle serving documentation over HTTP

I'm a fan of MiniTest::Spec. It strikes a nice balance between the simplicity of TestUnit and the readable syntax of RSpec. When I first switched from RSpec to MiniTest::Spec, one thing I was worried I would miss was the ability to add matchers. (A note in terminology: "matchers" in MiniTest::Spec refer to something completely different than "matchers" in RSpec. I won't get into it, but from now on, let's use the proper term: "expectations").

Understanding MiniTest::Expectations

Let's take a look in the code (I'm specifically referring to the gem, not the standard library that's built into Ruby 1.9):

# minitest/spec.rb

module MiniTest::Expectations
@wojtha
wojtha / db.rake
Created August 26, 2014 09:35 — forked from edjames/db.rake
namespace :db do
namespace :data do
desc "Dump data into sql script file: filename=[target filename]"
task :dump => 'environment' do
environment = (ENV.include?("RAILS_ENV")) ? (ENV["RAILS_ENV"]) : 'development'
ENV["RAILS_ENV"] = RAILS_ENV = environment
database = get_database(environment)
user = database
password = ENV['PASSWORD']
#!/bin/bash
echo "Installing Sublime text handler"
sudo cp sublime-handler /usr/local/bin
sudo cp sublime-handler.desktop /usr/share/applications/
echo "Updating desktop database"
sudo update-desktop-database
cat <<THE_END
Not done yet!
module ActsAsJSONStore
def self.included base
base.extend ClassMethods
end
module ClassMethods
attr_reader :fields_acting_as_json_store
# Declare a list of attributes in a model to act as JSON store.
# @param [Symbol, ...] The list of attributes.
inputs = %w[
CollectionSelectInput
DateTimeInput
FileInput
GroupedCollectionSelectInput
NumericInput
PasswordInput
RangeInput
StringInput
TextInput

What is it?

Collection of concerns for your Rails application

Installation

Copy to your app/models/concerns directory

Senior (enterprise)
Analyse and profile an application for performance and memory issues
Analyses and profile an application for security issues
Understand database modeling and query analysis
Tune a production deployment (Passenger, Thin, Apache etc)
Understand and use Ruby metaprogramming
Mentoring skills
Communication skills
Planning and Estimation