Skip to content

Instantly share code, notes, and snippets.

View thiagoramos23's full-sized avatar

Thiago Ramos thiagoramos23

View GitHub Profile
package controllers;
public class Application extends Controller {
// in cache during 1800 seconds (30 min)
@Cached(key = "pagingList", duration = 1800)
public static Result index(Integer page) {
String uuid = session("uuid");
if (uuid == null) {
uuid = java.util.UUID.randomUUID().toString();

Update and upgrade the system

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get autoremove
sudo reboot
# lib/tasks/deploy.rake
namespace :deploy do
desc 'Deploy to staging environment'
task :staging do
exec 'mina deploy -f config/deploy/staging.rb'
end
end
@thiagoramos23
thiagoramos23 / capybara cheat sheet
Last active September 1, 2015 11:42 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@thiagoramos23
thiagoramos23 / deploy.rb
Created November 19, 2015 17:42 — forked from stas/deploy.rb
Mina Deploy Task (Rails + Puma + Delay Job + rbenv)
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rbenv' # for rbenv support. (http://rbenv.org)
# require 'mina/rvm' # for rvm support. (http://rvm.io)
# Basic settings:
# domain - The hostname to SSH to.
# deploy_to - Path to deploy into.
# repository - Git repo to clone from. (needed by mina/git)
@thiagoramos23
thiagoramos23 / Rakefile.rb
Created August 23, 2017 23:24 — forked from drogus/Rakefile.rb
This is the example contents of the Rakefile, which you would use to run active record tasks without using Rails. It assumes using the same directories as rails uses: `db/migrate`, `config/database.yml`.
require 'bundler/setup'
require 'active_record'
include ActiveRecord::Tasks
db_dir = File.expand_path('../db', __FILE__)
config_dir = File.expand_path('../config', __FILE__)
DatabaseTasks.env = ENV['ENV'] || 'development'
@thiagoramos23
thiagoramos23 / where_is.rb
Created May 13, 2019 18:57 — forked from wtaysom/where_is.rb
A little Ruby module for finding the source location where class and methods are defined.
module Where
class <<self
attr_accessor :editor
def is_proc(proc)
source_location(proc)
end
def is_method(klass, method_name)
source_location(klass.method(method_name))
@thiagoramos23
thiagoramos23 / links.md
Last active November 7, 2019 18:47 — forked from akitaonrails/links.md
Links de referência pro Episódio 66 do Canal Akitando
@thiagoramos23
thiagoramos23 / transiftion-cross-effect.swift
Last active February 9, 2020 18:26 — forked from swiftui-lab/transiftion-cross-effect.swift
Transition in wich include the CircleShape Transition
// Advanced SwiftUI Transitions
// https://swiftui-lab.com
// https://swiftui-lab.com/advanced-transitions
import SwiftUI
struct CrossEffectDemo: View {
let animationDuration: Double = 2
let images = ["photo1", "photo2", "photo3", "photo4"]
@State private var idx = 0