Skip to content

Instantly share code, notes, and snippets.

View jasonmerino's full-sized avatar
👋
Hey there!

Jason Merino jasonmerino

👋
Hey there!
View GitHub Profile
<snippet>
<content><![CDATA[
console.log(require('util').inspect(${1:this}, {
depth: ${2:null},
colors: ${3:true}
}));
]]></content>
<!-- Set the tab trigger to nlog (node log) -->
<tabTrigger>nlog</tabTrigger>
<!-- Set the file scope to .js files -->
@jasonmerino
jasonmerino / opt-out.js
Last active August 29, 2015 14:13
Mobile Opt In/Out
javascript:(function () {
var query = window.location.search,
params = {},
key,
value;
query = query.indexOf('?') === 0 ? query.substring(1, query.length) : query;
query = query.split('&');
@jasonmerino
jasonmerino / last-week-on-github.js
Created September 30, 2014 15:38
Get a users submitted pull requests for a specific organization and repo
javascript:(function () {
function twoDigits(number) {
return number.toString().length === 1 ? '0' + number : number;
}
var date = new Date((new Date()).getTime()-1000*60*60*24*7),
org = 'jquery',
repo = 'jquery',
filters = [
'is:pr',
'author:jasonmerino',
find . -name "*.js" | grep -v node_modules | while read i; do js2coffee "$i" > "${i%.*}.coffee"; done
@jasonmerino
jasonmerino / jira-testing-instruction-bootstrapper.js
Last active August 29, 2015 14:05
JIRA Testing Instruction Bootstrapper
javascript:(function () {
function getPullRequestUrl() {
return prompt('Enter pull request URL');
}
function getSites() {
return [
'build',
'faucet',
@jasonmerino
jasonmerino / Backbone.Model.prototype.set.js
Last active August 29, 2015 14:04
Extends Backbone.Model.set to conform given properties to the models schema before setting them on the model.
Backbone.Model.prototype.defaultSet = Backbone.Model.prototype.set;
_.extend(Backbone.Model.prototype, {
/**
* Adds schema type casting to models before setting attributes
* @param {Object|String} key The key of the value to set or an object of value pairs
* @param {String|Object} val The value to set or the options object
* @param {Object|undefined} options The options for saving or undefined
*/
@jasonmerino
jasonmerino / form-populatr.js
Last active August 29, 2015 14:03
Form Populatr Bookmarklet
javascript:(function() {
// create a spec of field's -> values
// note: don't be silly and put actual credit card numbers in here, this is just for testing purposes
var spec = {
'credit-card': '4321 4321 4321 4321',
expiration: '12/23',
cvv: 987
};
for (var id in spec) {
@jasonmerino
jasonmerino / duplicate_id_alerter.js
Last active August 29, 2015 14:02
A bookmarklet to detect multiple ID's on a page
javascript:(function(){
var nodes = document.querySelectorAll('*'),
ids = [],
duplicates = [];
for (var i = 0; i < nodes.length; i++) {
var node = nodes[i];
if (node.id !== '') {
if (ids.indexOf(node.id) === -1) {
ids.push(node.id);
} else {
@jasonmerino
jasonmerino / pull-request-bootstrapper.js
Last active August 29, 2015 14:02
Github Pull Request Bootstrapper
javascript:(function () {
function get(selector) {
try {
return document.querySelector(selector);
} catch(error) {
return {};
}
}
@jasonmerino
jasonmerino / ld_mobile_branch.js
Last active August 29, 2015 14:00
LD Branch Build
javascript:(function(){
var b = prompt('Enter branch number.');
if(b !== null){
b = b.length === 3 ? '0' + b : b;
window.location.href='http://mob-'+b+'.mbranch.lightingdirect.com?abtest=off';
}
}());