Skip to content

Instantly share code, notes, and snippets.

View pjlsergeant's full-sized avatar
🙇‍♂️
I don't really have time for this anymore

Peter Sergeant pjlsergeant

🙇‍♂️
I don't really have time for this anymore
  • Bangkok, Thailand
View GitHub Profile
diff -rubw /tmp/Catalyst-Plugin-Authentication-0.10017//lib/Catalyst/Authentication/Credential/Password.pm ./lib/Catalyst/Authentication/Credential/Password.pm
--- /tmp/Catalyst-Plugin-Authentication-0.10017//lib/Catalyst/Authentication/Credential/Password.pm 2011-01-24 23:29:57.000000000 +0000
+++ ./lib/Catalyst/Authentication/Credential/Password.pm 2011-06-27 09:01:01.000000000 +0100
@@ -25,7 +25,7 @@
$self->_config->{'password_hash_type'} ||= 'SHA-1';
my $passwordtype = $self->_config->{'password_type'};
- if (!grep /$passwordtype/, ('none', 'clear', 'hashed', 'salted_hash', 'crypted', 'self_check')) {
+ if (!grep /$passwordtype/, ('none', 'clear', 'hashed', 'salted_hash', 'crypted', 'self_check', 'custom')) {
Catalyst::Exception->throw(__PACKAGE__ . " used with unsupported password type: " . $self->_config->{'password_type'});
@pjlsergeant
pjlsergeant / upgrading passwords.js
Created June 28, 2011 14:26
Upgrading passwords in place
// How to upgrade your users passwords in the DB without their intervention
//
// SHA-1 isn't strong enough to hash passwords with, but lots of people have a
// whole bunch of SHA-1'd passwords because they thought it was. You could use
// bcrypt or scrypt, but maybe in two years' time someone will tell you that's
// also not strong enough, and you'll want to upgrade.
//
// This sample demonstrates how you can remove weak password hashes from your
// user database, without needing the user to enter their password.
//
// And then...
var square = c.func({
'input': function () {
this.assert( arguments.length == 1, Error("Wrong number of arguments" ) );
this.assert( typeof arguments[0] == 'number', Error('Argument is a number') );
},
'output': function () {
this.assert( typeof arguments[0] == 'number', Error('Output is a number') );
},
'body': function (target) {
Feature: Addition
In order to avoid silly mistakes # These are inline `comments` in the
As a math idiot # form of an Agile User Story. They're
I want to be able to add two numbers # printed out during test execution.
Scenario: Add two numbers # This is a test case
Given I have entered 50 in to the calculator # This is a test *step*
And I have entered 70 in to the calculator # So is this
When I press add # And this
Then the result 120 should be on the screen # And the final one
if ( shipment['gift_message'] ) {
print_gift_message( 'gift-message-printer', shipment['gift_message'] );
}
"TakeMeasurements": {
// Specify the inputs we require. `warehouse` and `product_measurable` are
// custom types defined elsewhere, where `warehouse` is an enumeration of
// the client's warehouses, and `product_measurable` is a boolean value
"inputs": ["Type::warehouse", "Type::product_measurable"],
// Guarantee the type we will return
"output": "Type::Boolean",
// The rule itself. Note how it neither gets or sets any values outside of
"Type::warehouse": {
"constraint": create_enum('WH1', 'WH2'),
"cucumber": {
"type": "Given",
"match" : qr/the warehouse is "(WH\d)"/,
"describe": "the warehouse is \"{0}\"",
}
},
"Type::product_measurable": {
Given /I have entered (.*) into the calculator/ do |n|
calculator = Calculator.new # Create a new calculator object
calculator.push( n.to_i ) #
end
Scenario:
Given the warehouse is WH1
Then we are not required to take measurements
Scenario:
When the product is not measurable
Then we are not required to take measurements
Scenario:
Given the warehouse is WH2
When the product is measurable
Then we are required to take measurements
#!perl
use strict;
use warnings;
use Test::BDD::Cucumber::StepFile;
use Test::Mojo;
# Instantiates a new Test::Mojo object, and save it in the scenario-level stash.
# Rather than do this per-scenario, we'll store a copy in the feature-level and