I hereby claim:
- I am joshdover on github.
- I am joshdover (https://keybase.io/joshdover) on keybase.
- I have a public key ASAfX7rWttw5Abh7TK_kfxc421jTuwwL82kmpGLn_1W4Bwo
To claim this, I am signing this object:
| const TYPES_7_7_to_7_14 = [ | |
| "action", | |
| "action_task_params", | |
| "alert", | |
| "api_key_pending_invalidation", | |
| "apm-indices", | |
| "apm-server-schema", | |
| "apm-services-telemetry", | |
| "apm-telemetry", | |
| "app_search_telemetry", |
I hereby claim:
To claim this, I am signing this object:
| const Hapi = require('hapi'); | |
| const Boom = require('boom'); | |
| function installShim(server) { | |
| /** | |
| * Request wrapping factory that emulates Hapi v14 behavior. | |
| */ | |
| function handlerWrapper(originalHandler, { isPreResponse = false } = {}) { | |
| // Leave undefined, null, and string (registered server functions) values unchanged. |
| --- config.cc 2018-06-01 22:18:19.000000000 -0500 | |
| +++ config1.cc 2018-06-01 22:18:02.000000000 -0500 | |
| @@ -3258,7 +3258,7 @@ | |
| fprintf(fp, ", biosdetect=%s", SIM->get_param_enum("biosdetect", base)->get_selected()); | |
| - if (SIM->get_param_string("model", base)->getptr()>0) { | |
| + if (SIM->get_param_string("model", base)->getptr() != 0) { | |
| fprintf(fp, ", model=\"%s\"", SIM->get_param_string("model", base)->getptr()); | |
| } |
Install python-flamegraph into your project:
pip install git+https://github.com/evanhempel/python-flamegraph.git
Record a profile around a bit of code:
import flamegraph
thread = flamegraph.start_profile_thread(fd=open("./profile.log", "w"))| import { Modifier, EditorState, RichUtils } from 'draft-js'; | |
| import getCurrentlySelectedBlock from './getCurrentlySelectedBlock'; | |
| export const ALIGNMENTS = { | |
| CENTER: 'center', | |
| JUSTIFY: 'justify', | |
| LEFT: 'left', | |
| RIGHT: 'right' | |
| }; |
Testing React components seems simple at first. Then you need to test something that isn't a pure interaction and things seem to break down. These 4 patterns should help you write readable, flexible tests for the type of component you are testing.
I recommend doing all setup in the most functional way possible. If you can avoid it, don't set variables in a
beforeEach. This will help ensure tests are isolated and make things a bit easier to reason about. I use a pattern
that gives great defaults for each test example but allows every example to override props when needed:
| new MozActivity({ | |
| name: 'send', | |
| data: { | |
| type: 'text/plain', | |
| text: 'Hello Android, I am a web app!' | |
| } | |
| }); |
| describe('Controller: MyCtrl', function () { | |
| beforeEach(module('MyApp')); | |
| var scope; | |
| // Initialize the controller and a mock scope | |
| beforeEach(inject(function ($controller, $rootScope) { | |
| scope = $rootScope.$new(); | |
| startController = function() { | |
| $controller('MyCtrl', { |
| # Helper for tracking mixpanel events, allows for declaritve events. Usage: | |
| # <a href="http://google.com" data-mixpanel="name: 'clicked link'">Google</a> | |
| # <a href="http://cows.com" data-mixpanel="name: 'clicked link', data: { animal: 'cow' }">Cow</a> | |
| # <li data-mixpanel="'clicked list element'">I am not a link!</li> | |
| $(document).on "click", "[data-mixpanel]", (event) -> | |
| options = eval "({" + $(this).attr("data-mixpanel") + "})" | |
| # If event is bound to a link, add delay to ensure event is tracked. | |
| if event.currentTarget.href? | |
| options.data = {} if !options.data? |