Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am belfordz on github.
* I am belfordz (https://keybase.io/belfordz) on keybase.
* I have a public key ASCI6Pby_NvSKMw01bC0Z2VRoMuMfhcZdgxbX_nTsN4Ywwo
To claim this, I am signing this object:
0x4cfF645187bF1E7d1d03c1392074bec65d1B501A
0x6Bfc25A4e326c92520c5a648849F906aeA532A9d
@BelfordZ
BelfordZ / gist:fc65bb496ce247276f9e9afbaeab4497
Created May 22, 2017 03:30
get all the images from a webpage as an array
var a = document.getElementsByTagName('img'); var b = []; for (var i = 0; i < a.length; i++) { if (a[i].src.indexOf('http') !== -1) { b.push(a[i].src); } } console.log(`["${b.join(',')}"]`);
@BelfordZ
BelfordZ / mockCb.coffee
Created February 9, 2014 11:12
mock async function with jasmine
###*
* Mocks an asynchronous function that calls a callback on completion. It will setup a spy for you and call
* the callback immediately with the parameters provided (err and res).
* @param {Object} scope scope of the method to mock. Ex: fs = require("fs")
* @param {String} method name of the method to mock. Ex: "readFile"
* @param {Object} err first (error) parameter you want passed to the callback of the mocked function.
* Ex: to test the callback handler for the case where readFile has an error
* mockCb(fs, "readFile", new Error("readFile Error Test"), null)
* @param {Object} result second (result) parameter you want passed to the callback of the mocked function
* Ex: to test the callback handler for the case where readFile works as expected
@BelfordZ
BelfordZ / 0_reuse_code.js
Created November 14, 2013 18:24
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console