Skip to content

Instantly share code, notes, and snippets.

View voising's full-sized avatar

Guillaume Voisin voising

View GitHub Profile
@voising
voising / results.csv
Last active January 3, 2020 08:55
Marketplace - Search by rate & tags - Results
Nb of items returned by the query Ruby (Ruby on Rails) + AR Ruby (Ruby on Rails) + Sequel Crystal (Amber) Ratio: Ruby + AR/Crystal
10 17ms 10ms 4ms 4.25x
25 21ms 14ms 10ms 2.1x
50 24ms 18ms 12ms 2x
100 32ms 25ms 16ms 2x
200 54ms 36ms 20ms 2.7x
500 114ms 80ms 33ms 3.5x
1000 188ms 151ms 76ms 2.5x
@voising
voising / product_query.cr
Last active November 14, 2019 09:42
Marketplace - Search by rate & tags - Model - Crystal
class ProductQuery < Granite::Base
connection pg
column id : Int64, primary: true
column user_id : Int64
column title : String?
column description : String?
column tags : Array(Int64) | Nil
column amount : Float64?
column attachment : String?
@voising
voising / product_controller.cr
Last active November 13, 2019 06:08
Marketplace - Search by rate & tags - Controller - Crystal
require "cache"
class ProductController < ApplicationController
getter filter_by_tags : Bool?
def index
# NO TAGS -> CACHE
if !filter_by_tags? && !filter_by_rate?
# CACHE
@voising
voising / product.rb
Last active November 14, 2019 09:41
Marketplace - Marketplace - Search by rate & tags - Model
# frozen_string_literal: true
# == Schema Information
#
# Table name: products
#
# id :bigint not null, primary key
# user_id :bigint
# title :string
# description :text
@voising
voising / products_controller.rb
Last active November 14, 2019 09:41
Marketplace - Search by rate & tags - Controller
# frozen_string_literal: true
class ProductsController < ApplicationController
# GET /products
def index
📗𝟮𝟬𝟬 ProductSerializer.new(filtered_products)
end
private
require "redis"
worker_processes 8
preload_app true
timeout 600
listen '/tmp/vodeclic.sock', :backlog => 1024
pid '/tmp/vodeclic.pid'
##
# REE
@voising
voising / init_vagrant.sh
Last active December 19, 2015 13:48
Setup Vagrant Script
#!/bin/bash
rm -rf 5964832/
git init .
mkdir boxes; touch boxes/.gitkeep
mkdir definitions; touch definitions/.gitkeep
mkdir instances; touch instances/.gitkeep
mkdir iso; touch iso/.gitkeep
mkdir .chef; touch .chef/.gitkeep
mkdir -p chef/cookbooks; touch chef/cookbooks/.gitkeep
@voising
voising / crawl.rb
Last active December 19, 2015 06:18 — forked from jico/crawl.rb
Crawl website links #crawl
require 'net/http'
require 'uri'
if ARGV[0].nil?
puts "Usage : #{$0} url [output] "
exit
end
class Crawler
attr_reader :url_list
@voising
voising / append_this_to_url
Created June 15, 2013 23:23
SECURITY : Test if expose_php is on #testcreditsphp
?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000
@voising
voising / Gemfile
Created June 15, 2013 23:18
RUBY : Gems for development #devgems
gem 'meta_request'
gem "better_errors"
gem "binding_of_caller"
gem 'awesome_print'