Skip to content

Instantly share code, notes, and snippets.

💭
Wondering why Microsoft is turning Github into a social network

Nik Martin nikmartin

💭
Wondering why Microsoft is turning Github into a social network
Block or report user

Report or block nikmartin

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
@nikmartin
nikmartin / README.md
Last active Nov 9, 2018
High Performance Batched updates in Firestore
View README.md

Batched updates in Firestore

This short script shows how to do a batched update of a very large data set in firestore.

The scenario is I have a large set of products, and a 'pool' of product codes that need to be assigned to them. This script loads the list of UPC codes from a firebase database, then updates a firestore collection, updating every doc with a UPC code. For each product, the next code docID is assigned (so it's reall a pointer to the code, not the code itself), then the code is updated to signify that is has been assigned.

@nikmartin
nikmartin / namecheap-ddns.sh
Last active Apr 5, 2018 — forked from dalhundal/namecheap-ddns.sh
Shell script to update namecheap.com dynamic dns for a domain with your external IP address
View namecheap-ddns.sh
#!/bin/sh
# Shell script to update namecheap.com dynamic dns
# for a domain to your external IP address
HOSTNAME=yoursubdomain
DOMAIN=yourdomainname.com
PASSWORD=y0urp455w0rd
curl "https://dynamicdns.park-your-domain.com/update?host=$HOSTNAME&domain=$DOMAIN&password=$PASSWORD"
@nikmartin
nikmartin / build.sh
Created Mar 2, 2016
atom builder script
View build.sh
#!/bin/bash
git fetch -p && \
git checkout $(git describe --tags `git rev-list --tags --max-count=1`) && \
sed -i -e "/exception-reporting/d" -e "/metrics/d" package.json \
script/build && \
gksudo script/grunt install
@nikmartin
nikmartin / twiml.gs
Created Nov 9, 2015
Google Apps Script to produce Twilio TWIML
View twiml.gs
function doGet(e) {
var toNum = e.parameter.PhoneNumber;
var fromNum = e.parameter.CallerId;
var action = e.parameter.Direction;
var record = e.parameter.Record;
Logger.log(e);
var output = ContentService.createTextOutput();
var xml = createDialTWIML(fromNum, toNum, action);
@nikmartin
nikmartin / GetNextUpcomingDate.js
Last active Oct 28, 2015
This javascript snippet gets the date of the next day requested
View GetNextUpcomingDate.js
function getNextDate(whichDay) {
console.log(whichDay);
var today = new Date(); //Wed Oct 28 2015
var currentDayOfWeek = today.getDay(); //0-6
var thisWeeksSunday = today.getDate() - currentDayOfWeek; //1-31
var theDate = today;
//if whichDay has not happened this week yet:
if (whichDay > currentDayOfWeek) { //then get this weeks whichday
@nikmartin
nikmartin / updateContacts.js
Last active Aug 29, 2015
A short example of how to bulk update a list of Hubspot contacts using node.js and the Hubspot API
View updateContacts.js
/**
hubspot API - how to update a list of contatcs using hubspot API and node.js
The MIT License (MIT)
Copyright (c) 2015 Nik Martin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@nikmartin
nikmartin / hubspot_csv.js
Last active Feb 8, 2019
A short example of how to use the hubspot api in node.js to get a full CSV export of your contacts
View hubspot_csv.js
/**
hubspot API FULL CSV Export
A short example of how to use the hubspot api in node.js to get a full CSV export of your Hubspot contacts
The MIT License (MIT)
Copyright (c) 2015 Nik Martin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@nikmartin
nikmartin / inline.tpl
Created May 8, 2015
inline lodash/underscore template
View inline.tpl
<h3>Library Version (this html should be escaped): <%- '<h1>' + _.VERSION + '</h1>' %> </h3> <h2> <%- rc.listTitle %> </h2> <ul> <% _.each( rc.listItems, function( listItem ){ %> <li> <%- listItem.name %> <% if ( listItem.hasOlympicGold ){ %> <em>*</em> <% } %> </li> <% }); %> </ul> <% var showFootnote = _.any(
_.pluck( rc.listItems, "hasOlympicGold" )
); %> <% if ( showFootnote ){ %> <p style="font-size: 12px ;"> <em>* Olympic gold medalist</em> </p> <% } %>
@nikmartin
nikmartin / index.tpl
Created May 8, 2015
Underscore/Lodash template test
View index.tpl
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Underscore/lodash template test </title>
<script data-require="jquery@*" data-semver="2.1.4" src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<!--whichever one of these is LAST will get assigned to '_'-->
<script data-require="lodash.js@*" data-semver="3.8.0" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.8.0/lodash.js"></script>
View Signals.user.js
// ==UserScript==
// @name Clean Up Signals notifier.
// @version 0.2
// @include https://api.getsignals.com/*
// @include https://app.getsignals.com/*
// @include chrome-extension://*
// @require //ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js
// ==/UserScript==
var cleanDiv = $(".over-limit-state");
You can’t perform that action at this time.