Skip to content

Instantly share code, notes, and snippets.

@brettdh
brettdh / createClass-tests.patch
Created February 12, 2018 13:48
createClass tests for react/no-typos rule
diff --git a/tests/lib/rules/no-typos.js b/tests/lib/rules/no-typos.js
index bd4bfc5..a1229cc 100644
--- a/tests/lib/rules/no-typos.js
+++ b/tests/lib/rules/no-typos.js
@@ -847,5 +847,49 @@ ruleTester.run('no-typos', rule, {
}, {
message: 'Typo in prop type chain qualifier: isrequired'
}]
+ }, {
+ code: `
@brettdh
brettdh / README.md
Last active May 14, 2016 00:37
Difference in output for a simple failed test with testserver.Server, with the server socket interruption suppressed vs. raised

In the newly added test_server_finishes_on_error test for testserver.Server, I changed the pass in the except block to raise, to temporarily cause the test to fail. The two files in this gist show the difference in output between letting the select.error/socket.error from interrupting _accept_connection be raised vs. suppressed.

In socket_interruption_suppressed.txt, it is clear where the test failed - at the exception in the test function. In socket_interruption_raised.txt, there is extra output that distracts from the real failure. The test server is functioning as it should - allowing the server thread to be interrupted and exit gracefully when the test code leaves the with block - so the error output in this case is misleading. Nothing went wrong in the test server; it simply

@brettdh
brettdh / .block
Last active May 5, 2016 18:29
Stacked Area Chart with Missing Data
license: gpl-3.0
@brettdh
brettdh / .block
Last active May 5, 2016 18:23 — forked from mbostock/.block
Stacked Area Chart with Hidden Data Chunks
license: gpl-3.0
@brettdh
brettdh / setup_ndk_modules.py
Last active August 29, 2015 14:10
Script to search paths for importable Android NDK modules and symlink their build files to $NDK_MODULE_PATH.
#!/usr/bin/env python
import os, sys, re
import argparse
from itertools import combinations
module_re = re.compile("LOCAL_MODULE[^a-z_]+([a-z_]+)")
build_re = re.compile("BUILD_SHARED_LIBRARY")
def getModules(android_makefile):
### Keybase proof
I hereby claim:
* I am brettdh on github.
* I am brettdh (https://keybase.io/brettdh) on keybase.
* I have a public key whose fingerprint is 7D86 BC9D 69AB A548 7434 B9A4 DC84 0902 BE9D CDD5
To claim this, I am signing this object:
#include <iostream>
using namespace std;
#define PRINT_SIZE(type) cout << ("sizeof(" #type ") = ") << sizeof(type) << endl
int main()
{
PRINT_SIZE(unsigned int);
PRINT_SIZE(unsigned long);
PRINT_SIZE(unsigned long int);
$ nl -ba ./setcontext_test.cc
1 #include <stdio.h>
2 #include <ucontext.h>
3
4 static void foo(int bar)
5 {
6 printf("Called foo with argument: %d\n", bar);
7 }
8
9 #define STACK_SIZE 262144