Skip to content

Instantly share code, notes, and snippets.

View andreapavoni's full-sized avatar
🎧
❤️‍🔥🪩🕺🏻🚀

Andrea Pavoni andreapavoni

🎧
❤️‍🔥🪩🕺🏻🚀
View GitHub Profile
@andreapavoni
andreapavoni / gulpfile.coffee
Created November 28, 2014 10:36
Gulp + browserify + coffeelint + bower + ...
gulp = require('gulp')
gutil = require('gulp-util')
browserify = require('gulp-browserify')
coffeelint = require('gulp-coffeelint')
rename = require('gulp-rename')
uglify = require('gulp-uglify')
size = require('gulp-size')
clean = require('gulp-rimraf')
# LOAD ENVs to use with envify
@andreapavoni
andreapavoni / gentoo-cloner.sh
Created December 4, 2014 10:02
Gentoo cloner: old utility to clone gentoo installation on twin machines
#!/bin/bash
# GentooCloner 0.5.1_alpha - clone your gentoo on identical/similar machines or just do a stage4 :)
AUTHOR="Copyright (c) 2006 Andrea Pavoni (http://andreapavoni.com)"
LICENSE="
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright

Keybase proof

I hereby claim:

  • I am apeacox on github.
  • I am andreapavoni (https://keybase.io/andreapavoni) on keybase.
  • I have a public key whose fingerprint is 15C2 22EB 70D4 9D43 590F DFF6 F380 C6BA 450C B260

To claim this, I am signing this object:

class CreateEmailTest
include Lotus::Interactor
def initialize(params)
@params = params
@email_test = EmailTest.new(@params[:email_test])
end
def call
Operation.new(self, email_test: @email_test).
require "virtus"
module Commands
module Base
def self.included(base)
base.extend ClassMethods
base.include Virtus.model
base.include ActiveModel::Validations
base.prepend InstanceMethods
package main
import (
"bytes"
"exec"
"log"
"os"
)
// Pipeline strings together the given exec.Cmd commands in a similar fashion
This:
<p>Please <%= link_to "sign in", :controller => 'account', :action => 'login' %> to comment.</p>
Could be:
<p>
<%= I18n.t('views.formulas.please') %>
<%= link_to I18n.t('views.actions.sign_in'), :controller => 'account', :action => 'login' %>
<%= I18n.t('views.actions.to_comment') %>.
</p>
@andreapavoni
andreapavoni / secure_random.ex
Last active September 4, 2015 08:18 — forked from Myuzu/secure_random.ex
Elixir ruby-like SecureRandom
defmodule SecureRandom do
@moduledoc """
Ruby-like SecureRandom module.
## Examples
iex> SecureRandom.base64
"xhTcitKZI8YiLGzUNLD+HQ=="
iex> SecureRandom.urlsafe_base64(4)
@andreapavoni
andreapavoni / role_play.rb
Created April 29, 2010 12:54
simple user roles management with ActiveRecord
module RolePlay
module PluginMethods
def has_roleplay(roles = {})
@@roles = roles
@@roles_ids = roles.invert
def roles
@@roles
end
@andreapavoni
andreapavoni / _search_form.html.erb
Created July 1, 2010 16:41
Rails3: using Arel to make conditional searches based on conditional params
<div id="searchform">
<%= form_tag search_people_path, :method => 'get' do |f| %>
<div class="field">
<%= label :search, :firstname, 'Firstname' %><br/>
<%= text_field :search, :firstname %>
</div>
<div class="field">
<%= label :search, :lastname, 'Lastname' %><br/>
<%= text_field :search, :lastname %>
</div>