I hereby claim:
- I am masonmark on github.
- I am masonmark (https://keybase.io/masonmark) on keybase.
- I have a public key ASAwAUdfwTc-kIw-jIMOA2XxzrXxqRPPvylGFYFCrIkxsAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| // WastingTimeOnStackOverflowTests.swift Created by mason on 2016-09-18. | |
| import XCTest | |
| /// Measures performance of two different ways of checking whether an index is valid | |
| /// for a given array (the variable "a" is an array of 1,000,000 unique strings, and | |
| /// "val" is the index to be checked): | |
| /// | |
| /// a.indices.contains(val) | |
| /// vs: |
| #!/usr/bin/env ruby | |
| # A script to clean-build all 3 targets in one step, and return success/failure (0/nonzero). | |
| require 'pathname' | |
| require 'fileutils' | |
| require 'open3' | |
| PATH_TO_ME = Pathname.new(File.expand_path(__FILE__)) | |
| PATH_TO_ROOT = PATH_TO_ME.parent.parent |
| // CatchObjCException.h Created by mason on 2015-10-30. Copyright © 2015 mason. All rights reserved. | |
| #import <Foundation/Foundation.h> | |
| /// An Objective-C function that executes `block` using `\@catch` to trap and return any thrown NSException. | |
| /// | |
| /// WHY: Although "discouraged" for years, Apple's system frameworks nevertheless throw exceptions in many places. There | |
| /// is no way in Swift code to handle these exceptions; the application will simply crash whenever Foundation or AppKit | |
| /// throws an exception. (It seems inconceivable that Apple would not address this somehow, someday, but it's still true | |
| /// as of Swift 2.1 in October 2015. (Also, I suspect they might address it by fixing the frameworks, not Swift.)) |
| This is some example text. | |
| And some more. AND SOME MORE. |
| export NODE_PATH=/usr/local/lib/node:/usr/local/lib/node_modules | |
| export PATH=/usr/local/bin:$PATH | |
| echo "Compiling .coffee assets..." | |
| RESULT=`/usr/local/bin/coffee -c ${PROJECT_DIR}` | |
| if [ $? -ne 0 ] | |
| then | |
| echo "The coffee command exited with non-zero exit status." |
| Anonymous UUID: 906F4C43-A62F-E5B8-42BA-0DF615FED023 | |
| Sat Oct 26 13:14:15 2013 | |
| panic(cpu 2 caller 0xffffff80058dc19e): Kernel trap at 0xffffff7f87107855, type 14=page fault, registers: | |
| CR0: 0x000000008001003b, CR2: 0x0000000000000100, CR3: 0x00000002f31140f5, CR4: 0x00000000001606e0 | |
| RAX: 0x0000000020020200, RBX: 0xffffff81b5bd8000, RCX: 0x0000000105e20000, RDX: 0xffffff81b5bd926c | |
| RSP: 0xffffff81ddf23930, RBP: 0xffffff81ddf23980, RSI: 0x0000000000000100, RDI: 0x0000000000000207 | |
| R8: 0xffffff829c847020, R9: 0x0000000000000000, R10: 0x0000000000000000, R11: 0x0000000000000001 | |
| R12: 0x0000000000000001, R13: 0xffffff81b5bd8178, R14: 0xffffff803995f501, R15: 0xffffff81b5bd9150 | |
| RFL: 0x0000000000010206, RIP: 0xffffff7f87107855, CS: 0x0000000000000008, SS: 0x0000000000000010 |
| find_elements = (tag_name, properties = {}, die_if_not_found = true) -> | |
| # Find all elements of type tag_name that match properties. E.g.: find_elements "input", {type: "image", src: "my_img.jpg"}. Note that if you are looking for an element by its 'src' property (e.g. for an image), be aware that the if the HTML specifies something like /foo/bar that actual property value will be something like "http://192.168.155.100/foo/bar". There may be other element properties which aren't exactly identical to what is specified in the HTML(?). | |
| result = null | |
| all_elements = document.getElementsByTagName(tag_name) | |
| filtered = filter_elements all_elements, properties | |
| if filtered.length > 0 | |
| filtered | |
| else | |
| if die_if_not_found | |
| die "unable to find required page element of type '#{tag_name}' matching #{JSON.stringify properties}'" |
| [mason@IT-PC-MACPRO-01 dna2]$ echo 'First let us use the PhantomJS 1.3 binary download:'First let us use the PhantomJS 1.3 binary download: | |
| [mason@IT-PC-MACPRO-01 dna2]$ phantomjs euc_test.coffee | |
| ☆ LOAD STATUS: success | |
| ☆ PAGE TITLE:ÆüËܸì - Japanese test | |
| ☆ PAGE CONTENT: <html><head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=euc-jp"> | |
| <title>ÆüËܸì - Japanese test</title> | |
| </head><body> | |
| <p>ÆüËܸì¤Î¥Æ¥¥¹¥È¡£</p> |
| mason@ubuntu:~$ sudo bash | |
| [sudo] password for mason: | |
| root@ubuntu:~# | |
| root@ubuntu:~# | |
| root@ubuntu:~# | |
| root@ubuntu:~# | |
| root@ubuntu:~# | |
| root@ubuntu:~# sudo gdb | |
| sudo: gdb: command not found | |
| root@ubuntu:~# apt-get install gdb |