Skip to content

Instantly share code, notes, and snippets.

Avatar

Philippe Lafoucrière gravis

View GitHub Profile
View modula-mojito.css
/* Fields */
input[type='text'], input[type='password'], textarea { font-size: 13px; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; }
input[type="text"], textarea, select { padding: 2px; }
input[type="text"]:focus, textarea:focus, select:focus { }
option { }
input#issue_subject { font-size: 200%; width: 90%; }
input#issue_subject, #project_description { width: 92.5%; }
textarea#issue_description { width: 93%;}
@gravis
gravis / Dockerfile
Last active Sep 22, 2015
Docker Volume sharing
View Dockerfile
FROM docker:5000/wheezy-ruby
# install deps
RUN apt-get install -y qt4-qmake libqtwebkit-dev libcurl4-openssl-dev
RUN mkdir -p /bundle /rails
RUN apt-get install -y ssh
RUN mkdir -p /var/run/sshd
View factory_girl_step_helpers.rb
module FactoryGirlStepHelpers
def convert_human_hash_to_attribute_hash(human_hash, associations = [])
HumanHashToAttributeHash.new(human_hash, associations).attributes
end
class HumanHashToAttributeHash
attr_reader :associations
def initialize(human_hash, associations)
@human_hash = human_hash
@gravis
gravis / collector_transaction.rb
Created Aug 6, 2012
A secure event tracking system for online betting in France
View collector_transaction.rb
# Copyright © 2010-2011 Tech-Angels. All Rights Reserved.
# CollectorTransaction will be created each time the Collector needs
# to trace an activity.
#
# Attributes:
# * id [integer, primary, not null] - primary key
# * before_tr [binary] - associated model serialized before transaction
# * created_at [datetime] - creation time
# * model_id [integer] - belongs_to Model (polymorphic)
@gravis
gravis / Questions
Created Aug 9, 2011
Frozen Rails Give-away
View Questions
Day job: CEO @ Tech-Angels.fr
Your Rails contributions (if any): a few bugs reporting/squashing
What's your Ruby/Rail experience?: Since 1.0, so a few years :)
How do you use GitHub?: Professionnaly to host our projects sources and configurations, personally to serve^h^h^h^h^hfork and protect^h^h^h^h^hhack
View bonus-2011-05-02.sql
select orders.user_id,
email,
sum(stake) as mises_perdantes,
5.00 as bonus
from bets
join orders on orders.id = bets.order_id
join users on orders.user_id = users.id
join races on races.id = bets.race_id
where races.start_time::date BETWEEN '2011-04-29' AND '2011-04-30'
and bets.status = 'paid'
View gist:640183
>> Event.find(123).participants.ascend_by_number
[works]
>> Event.find(123).participants.published.all(:order => :number)
[works]
>> Event.find(123).participants.published.ascend_by_number
[returns the whole table until memory is full and server crash]
SQL :
SELECT * FROM "events" WHERE ("events"."id" = 123)
View gist:637301
rvm update --trace
--trace
rvm 1.0.15 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]
+__rvm_parse_args:416> [[ -z 4.3.9 ]]
+__rvm_parse_args:572> [[ -z update ]]
+__rvm_parse_args:574> [[ 0 -eq 1 || -n '' ]]
+__rvm_parse_args:15> [[ -n '' ]]
+__rvm_parse_args:578> [[ 0 -gt 0 ]]
@gravis
gravis / readme
Created Sep 26, 2010
tcp syslog logger for rails draft
View readme
tcp_syslog is now a gem :
https://github.com/tech-angels/tcp_syslog
View gist:527128
require 'rubygems'
require 'wirble'
require 'hirb'
Wirble.init
Wirble.colorize
# hirb (active record output format in table)
Hirb::View.enable
# IRB Options
IRB.conf[:AUTO_INDENT] = true