Skip to content

Instantly share code, notes, and snippets.


Philippe Dionne phildionne

View GitHub Profile
View .drone.yml
kind: pipeline
name: default
- name: test
image: ruby:2.6.3-alpine
- echo $FOO
- echo $BAR
View a.html
<a href="/">Home</a>
View application.rb
# config/application.rb
module MyApp
class Application < Rails::Application
# Handle exceptions with a custom controller
config.exceptions_app = lambda do |env|
View gist:9c4433ad5c41bc4ee5039cf46925d9aa
### Keybase proof
I hereby claim:
* I am phildionne on github.
* I am pdionne ( on keybase.
* I have a public key ASALJIZd1Snk6_xqNGbjBFC-_Kmin4X8vbfm_A25PmSf5Qo
To claim this, I am signing this object:
phildionne / bot.rb
Last active May 20, 2016
Dialog Analytics example integration in a Facebook Messenger and Ruby chatbot.
View bot.rb
require_relative './dialog'
require 'facebook/messenger' #
Facebook::Messenger.configure do |config|
config.access_token = ENV['FACEBOOK_ACCESS_TOKEN']
config.verify_token = ENV['FACEBOOK_SECRET_TOKEN']
include Facebook::Messenger
phildionne / bot.rb
Last active May 20, 2016
Dialog Analytics example integration in a Telegram and Ruby chatbot.
View bot.rb
require_relative './dialog'
require 'telegram/bot' #'TELEGRAM_TOKEN')) do |bot|
bot.listen do |message|
case message.text
when '/test'
text = "Welcome to test"
View script.rb
@client.query_in_batches("SELECT * FROM Invoice", per_page: 1000) do |records|
records.entries.each do |record|
# Record has an active class
if record.class_ref.present? && !é/)
reference = record.class_ref
# Find project & organisation
project = Project.find_by!(quickbooks_class_id: reference.value)
organisation = project.organisation
View gist:380b9ba5272bf2017355
FactoryGirl.define do
# Points according to Geojson specifications (X, Y) or (Longitude, Latitude)
sequence :point do
[38.15704300068319, 82.64793458394706],
[65.25863617658615, -24.040317703038454],
[-144.94273960590363, 20.84642690140754],
[137.46707799844444, 80.3652603412047],
[-131.11246040090919, 3.13029068056494],
[-37.99821515567601, 70.2160071535036],
phildionne / apartment.rb
Last active Aug 29, 2015
Rails + Apartment + PostGIS + activerecord-postgis-adapter
View apartment.rb
Apartment.configure do |config|
config.persistent_schemas = %w{ shared_extensions }
View lazy.rb
# Enumerator#lazy is very slow and should only be used when iterating over large/infinite collections
# where you know you are going to get your results quite early in the iteration.
require 'benchmark/ips'
Benchmark.ips do |r|"map") do
(0..50).map{ |i| 'lol' if i.even? }
You can’t perform that action at this time.