Skip to content

Instantly share code, notes, and snippets.

View tildedave's full-sized avatar
🌮
Hungry

Dave King tildedave

🌮
Hungry
View GitHub Profile
@tildedave
tildedave / forms.py
Last active January 13, 2019 00:22
Primes of the form x^2 + ny^2, David Cox, Exercise 2.9. Determine quadratic forms for a given discriminant D < 0
from math import sqrt, gcd
import unittest
from typing import Tuple, Set
def discriminant(a, b, c):
return b*b - 4 * a * c
def get_reduced_forms(D) -> Set[Tuple[int, int, int]]:
//
// AppDelegateTests.m
#import <XCTest/XCTest.h>
#import "AppDelegate.h"
#import "User.h"
@interface AppDelegateTests : XCTestCase
@end

Keybase proof

I hereby claim:

  • I am tildedave on github.
  • I am tildedave (https://keybase.io/tildedave) on keybase.
  • I have a public key whose fingerprint is 695A 386A DC84 3C8E CC65 3ECA 4E1E BF72 F987 9B01

To claim this, I am signing this object:

client
.page.homepage().load()
.signUpEmailUser('UserMenu Tester')
.whenDesktop(function() {
client.page.navbar().verifyUserName('UserMenu Tester');
})
.pause(500)
.page.navbar().openUserMenu()
.whenDesktop(function() {
return client.page.navbar().verifyProfileLink();
$ TEST_ENVIRONMENT=staging magellan --config=./magellan.jenkins.json --tag desktop
Loaded magellan configuration from: /Users/dave/workspace/tilt-nightwatch/magellan.jenkins.json
Magellan-nightwatch test iterator found nightwatch configuration at: ./nightwatch.conf.js
Using tag filter: [ 'desktop' ]
Running 78 tests with 8 workers with phantomjs
--> Worker 1, mock port: 21000, running test: test/comment_view_spec.js @phantomjs
--> Worker 2, mock port: 21003, running test: test/connect_via_notification_center_spec.js @phantomjs
--> Worker 3, mock port: 21006, running test: test/connect_via_search_center_spec.js @phantomjs
INFO Request: POST /wd/hub/session/23f28a8d-e6a7-4025-99cd-4abf6302e4d2/timeouts/async_script
- data: {"ms":10000}
- headers: {"Content-Type":"application/json; charset=utf-8","Content-Length":12}
INFO Response 200 POST /wd/hub/session/23f28a8d-e6a7-4025-99cd-4abf6302e4d2/timeouts/async_script{ sessionId: '23f28a8d-e6a7-4025-99cd-4abf6302e4d2',
status: 0,
state: 'success',
value: null,
class: 'org.openqa.selenium.remote.Response',
hCode: 595100226 }
LOG → Completed command timeoutsAsyncScript (10 ms)
use JavaScript::V8;
use JSON;
my $v8context = JavaScript::V8::Context->new();
$v8context->bind(f => JSON::false);
my $res = $v8context->eval('(function() { return (f ? 1 : 0) })()');
print "$res\n";
# returns 1, because JSON::false is bound to the empty object and so truthy
my $res = $v8context->eval('typeof f');
var Immutable = require('immutable'),
createStore = require('dispatchr/utils/createStore'),
var ExperimentStore = createStore({
storeName: 'ExperimentStore',
initialize: function() {
this._experiments = Immutable.Map();
},
@tildedave
tildedave / linkMatches.js
Last active August 29, 2015 14:16
Custom assertion for Nightwatch to see if a link has the expected text and destination
var util = require('util');
exports.assertion = function(selector, text, href, msg) {
var DEFAULT_MSG = 'Testing if link <%s> contains text <%s> and ends with href <%s>".';
var MSG_ELEMENT_NOT_FOUND = DEFAULT_MSG + ' ' + '<%s> could not be located.';
var MSG_TEXT_DID_NOT_MATCH = DEFAULT_MSG + ' ' + ' Actual text <%s> did not contain <%s>.';
var MSG_HREF_DID_NOT_MATCH = DEFAULT_MSG + ' ' + ' Actual href <%s> did not end with <%s>.';
this.message = msg || util.format(DEFAULT_MSG, selector, text, href);
@tildedave
tildedave / createFacebookTestUser.js
Last active May 25, 2016 22:29
Nightwatch Command for Creating Facebook Test User
var util = require('util');
var events = require('events');
var Promise = require('bluebird');
var request = Promise.promisify(require('request'));
var CreateFacebookTestUser = function() {
events.EventEmitter.call(this);
};
util.inherits(CreateFacebookTestUser, events.EventEmitter);