Skip to content

Instantly share code, notes, and snippets.

Brian Riley brianmriley

Block or report user

Report or block brianmriley

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
brianmriley /
Created Oct 22, 2019 — forked from jpf/
How to fetch the SSL certificate from
echo '' | openssl s_client -connect
brianmriley / set-html-file-input-programmatically
Created Nov 20, 2018
Demonstrates how one can programmatically set a HTML file input's value.
View set-html-file-input-programmatically
// Taken from SO:
const dT = new ClipboardEvent('').clipboardData || // Firefox < 62 workaround exploiting
new DataTransfer(); // specs compliant (as of March 2018 only Chrome)
dT.items.add(new File(['foo'], 'programmatically_created.txt'));
inp.files = dT.files;
View jasmine-unit-test-for-method-called-in-constructor
describe("Foo constructor", function() {
it("should call its `bar()` instance method.", function() {
spyOn(Foo.prototype, 'bar');
var foo = new Foo();
brianmriley / Grepping log files and outputting new files
Last active Apr 27, 2016
Grepping logs and outputting to a new file.
View Grepping log files and outputting new files
// grep {searchString} {targetFile} > {outputFile}
grep "loadChunk(" mysxm.log > mysxm-load-chunk.log
brianmriley / bash-profile-chrome-dev
Last active Feb 22, 2018
Adds an alias to your bash profile to launch chrome in "developers mode", aka less secure. This allows you to use some high-security, and bleeding edge JavaScript like `subtle.crypto` in HTTP instead of HTTPS in localhost.
View bash-profile-chrome-dev
# Chrome
alias chrome="open /Applications/Google\"
alias chromedev="open /Applications/Google\ --args --ignore-certificate-errors --allow-running-insecure-content --reduce-security-for-testing --disable-web-security --unsafely-treat-insecure-origin-as-secure= --user-data-dir=~/Library/Application Support/Google/Chrome/Default"
brianmriley / javascript-console-logging-wrapper
Last active Apr 27, 2016
Attempt to wrap the `console.log()` method of the browser and successfully bind to the client object calling `logger.debug()` and not the logger itself.
View javascript-console-logging-wrapper
// I've created a simple logger (wraps console.* methods) that provides output similar to say Log4J or other robust
// loggers out there for the enterprise, but a huge missing piece (for me) is that you can no longer see the file
// reference and line number from the client object using the logger. When you use console.log() OOTB it'll spit out
// a clickable link to the file and line number that executed the console.log making it easy to debug; when you wrap
// console.log it simply spits out the logger file reference and the line number the console.log was executed, so
// all logging shows up as from the logger wrapper (which is technically correct)...bottom line, you lose the context
// from which you actually made the logging call and I'd like to get that back.
// Aside from blackboxing, is there another way to wrap console.log() such that it binds to the client callee
// and ultimately shows the correct file reference and line number of the callee (and not the log wrapper)?
View edit-password-in-git-tower
1) Open repo in tower.
2) Right-click on remotes/origin in left pane.
3) Select `Edit Connection Settings`.
View promise-loop-sequence.js
var urlList = model.getURLs();
var loadAndParse = function (url)
// both load() and parse() are promise based functions
return load(url).then(parse);
* Allows for the sequentially calling of promise based functions by iterating over a list of
brianmriley / string-dot-notation-to-object
Last active Sep 23, 2019
Convert Javascript string in dot notation into an object reference
View string-dot-notation-to-object
// pulled from SO
// NOTE: Array.reduce() may not be available in older browsers
function index(obj,i) {return obj[i]}
'a.b.etc'.split('.').reduce(index, obj);
var obj = {a:{b:{etc:5}}};
brianmriley / AngularJS-Service-Factory-Provider-Example.js
Last active Aug 29, 2015 — forked from Mithrandir0x/gist:3639232
AngularJS Service vs Factory vs Provider Implementations
View AngularJS-Service-Factory-Provider-Example.js
// Source:!topic/angular/hVrkvaHGOfc
// jsFiddle:
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
You can’t perform that action at this time.