Skip to content

Instantly share code, notes, and snippets.

View adamico's full-sized avatar

Andrea D'Amico adamico

  • France
  • 00:11 (UTC +01:00)
View GitHub Profile
@adamico
adamico / cf_modpack_workflow.md
Last active September 28, 2023 14:46
Workflow to manage Minecraft Curseforge modpacks
@adamico
adamico / pack.c
Created November 28, 2015 14:39
C source of .pack in ruby
static VALUE
pack_pack(VALUE ary, VALUE fmt)
{
static const char nul10[] = "\0\0\0\0\0\0\0\0\0\0";
static const char spc10[] = " ";
const char *p, *pend;
VALUE res, from, associates = 0;
char type;
long items, len, idx, plen;
const char *ptr;
@adamico
adamico / Gemfile
Created July 30, 2015 12:46
Use CombinePDF in a Rails app to merge existing PDF files with Prawn generated PDF content
gem 'combine_pdf'
gem 'prawn'
gem 'paperclip'
@adamico
adamico / en.yml
Last active June 21, 2017 05:46 — forked from johnjohndoe/uri_validator.rb
Rails 4 with I18n working interpolations
en:
errors: &errors
messages:
bad_uri: is an invalid url
bad_protocol: must start with %{protocols}
activemodel:
errors:
<<: *errors
activerecord:
errors:
@adamico
adamico / devise.fr.yml
Last active December 26, 2015 21:29 — forked from simonc/devise.fr.yml
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
fr:
devise:
confirmations:
confirmed: 'Votre compte a été validé, vous êtes maintenant connecté'
send_instructions: 'Vous allez recevoir les instructions nécessaires à la confirmation de votre compte dans quelques minutes'
send_paranoid_instructions: 'Si votre e-mail existe dans notre base de données, vous allez bientôt recevoir un e-mail contenant les instructions de confirmation de votre compte.'
failure:
already_authenticated: "Vous êtes déjà connecté !"
@adamico
adamico / gist:6592299
Last active December 23, 2015 06:09
nokogiri blog parsing for http://blog.shopittome.com/
require 'open-uri'
require 'nokogiri'
doc = Nokogiri::HTML(open("http://www.threescompany.com/"))
titles = doc.css("#content_inner h2")
containers = doc.css("#content_inner .format_text")
articles = []
titles.each_with_index do |title, i|
images = containers[i].css("div > img, a > img")[0..-2]
images = images.map { |image| image.attributes["src"].value }
@adamico
adamico / collection_check_boxes_input.rb
Last active April 28, 2020 15:12 — forked from mattclar/simple_form.rb
This fork adds a custom horizontal form wrapper and merges append/prepend in a 'group' wrapper
#app/inputs/collection_check_boxes_input.rb
class CollectionCheckBoxesInput < SimpleForm::Inputs::CollectionCheckBoxesInput
def item_wrapper_class
"checkbox-inline"
end
end
@adamico
adamico / collection_check_boxes_input.rb
Created September 6, 2013 09:53
SimpleForm inline collection radio_buttons/checkboxes for Twitter Bootstrap 3
#app/inputs/collection_check_boxes_input.rb
class CollectionCheckBoxesInput < SimpleForm::Inputs::CollectionCheckBoxesInput
def item_wrapper_class
"checkbox-inline"
end
end
@adamico
adamico / simple_form_bootstrap.rb
Created August 30, 2013 09:06
Twitter Bootstrap 3 initializer for Simple Form
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
# you need an updated simple_form gem for this to work, I'm referring to the git repo in my Gemfile
config.input_class = "form-control"
config.wrappers :bootstrap, tag: 'div', class: 'form-group', error_class: 'error' do |b|
b.use :html5
b.use :placeholder
b.use :label
b.use :input
@adamico
adamico / gist:1077608
Created July 12, 2011 08:27
multiple nested engine failing on refinerycms 1.0.3
refinerycms test-multiple-nested-engines
rails generate refinery_engine father name:string
bundle install
rails generate refinerycms_fathers && rake db:migrate
rails generate refinery_engine son name:string fathers:engine
bundle install
rails generate refinerycms_sons && rake db:migrate
rails generate refinery_engine daughter name:string fathers:engine
bundle install
rails generate refinerycms_daughters