Skip to content

Instantly share code, notes, and snippets.

View ameuret's full-sized avatar

Arnaud Meuret ameuret

View GitHub Profile
from bezier import *
class AFewQuads:
list = []
a = Point(231.5, 132.3)
# curveto
a = Point(231.5, 132.3)
b = Point(251.3, 135.5)
c = Point(272.9, 120.3)
d = Point(277.2, 94.0)
list.append(BezierQuad(a, b, c, d))
class AFewQuads:
list = []
a = Point(231.5, 112.5)
# curveto
a = Point(231.5, 112.5)
b = Point(251.3, 116.0)
c = Point(272.9, 99.5)
d = Point(277.2, 71.0)
list.append(BezierQuad(a, b, c, d))
# curveto

Keybase proof

I hereby claim:

  • I am ameuret on github.
  • I am arnaudm (https://keybase.io/arnaudm) on keybase.
  • I have a public key ASDnOFChad3ZpfJQBMoH81__7Qd4DZktk9EwYAMCoQBU3Ao

To claim this, I am signing this object:

@ameuret
ameuret / NOTES.md
Created March 13, 2017 11:59
When running tests for a Rodauth-enabled app

You will probably need to clean your database between some (or each) of yours test cases/scenarios.

When running Capybara+PhantomJS, using table truncation is preferred since transactions are not shared between the test process and the browser process.

This means that you need to authorize the app account to truncate the appropriate tables. In the database setup transactions, this can be done for the accounts table with:

    run "GRANT TRUNCATE ON account_password_hashes TO #{user}"

Make sure that you do the same for each table created by the Rodauth features you have enabled, e.g. here for the disallow_password_reuse feature:

@ameuret
ameuret / DB_schema.rb
Created June 23, 2016 08:53
Unexpected boolean results with Sequel 4.34.0 (sqlite)
DB.schema(:persons)[6]
[:preferred,
{:allow_null=>true,
:default=>nil,
:db_type=>"Boolean",
:primary_key=>false,
:type=>:boolean,
:ruby_default=>nil}]
@ameuret
ameuret / buying_steps.rb
Created February 6, 2014 21:40
How to help Capybara wait for a node to appear as a result of some asynchronous operation
include CapybaraAccessories
# This step occurs after an item was added to the cart through XHR
# It must wait for the call to return and for the UI to update.
# A badge must become visible and contain the number of items in cart.
# Without this kind of wait code Capybara's waiting features (2.2.1)
# still miss the update and fail the test.
Then(/^I see a caddie badge with (\d+) item\(s\)$/) do |count|
wait_for{page.find('#count')}.should have_content(count)
@ameuret
ameuret / sickwell.rb
Created March 6, 2013 21:56
As a newcomer to Sequel's ORM, it took me quite a while to figure out why this code would throw `method mimetype= doesn't exist (Sequel::Error)` on the `create` call.
require 'sequel'
DB = Sequel.sqlite
DB.create_table :mimetype do
primary_key :id
column :mimetype, :text, :unique=>true
column :extension, :text
end
@ameuret
ameuret / m2config_spec.rb
Created February 20, 2012 16:38
Ruby rescue statement modifier caveat
describe M2Config do
before(:each) do
File.delete DEFAULT_DB_NAME rescue
@cfg = M2Config.new
end
end
@ameuret
ameuret / locate_agent.feature
Created July 15, 2011 12:11
Reusing Gherkin steps
Scenario: Locate a running agent
Given an ssh agent has been launched without parameters
When I run `ssh-locate`
Then the output should contain "SSH_AUTH_SOCK="
And the output should contain "export SSH_AUTH_SOCK;"
And the output should contain "SSH_AGENT_PID="
And the output should contain "export SSH_AGENT_PID;"
And the output should contain the correct agent PID
And the output should contain the correct agent socket