Skip to content

Instantly share code, notes, and snippets.

🍜
slurp slurp

Martin Sweeny martin-sweeny

🍜
slurp slurp
Block or report user

Report or block martin-sweeny

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
View keybase.md

Keybase proof

I hereby claim:

  • I am martin-sweeny on github.
  • I am martinsweeny (https://keybase.io/martinsweeny) on keybase.
  • I have a public key whose fingerprint is 1F70 9F7B 5B18 EE4A 8960 281E FC4D F957 A3C9 CB5C

To claim this, I am signing this object:

View keybase.md

Keybase proof

I hereby claim:

  • I am martin-sweeny on github.
  • I am martin_wiseweb (https://keybase.io/martin_wiseweb) on keybase.
  • I have a public key ASCss-qCBeQ1pqXrmirf1YdOGFZ3AlMfB6FX72AnfwxOCwo

To claim this, I am signing this object:

@martin-sweeny
martin-sweeny / async-fun.js
Created Jan 13, 2018
Playing with async/await
View async-fun.js
timed = async i => new Promise(resolve => {
console.log(`starting ${i}`)
setTimeout(() => {
resolve('done!');
console.log('yo', i)
}, Math.random() * 5000)
});
parallel = async count => {
timers = [], msgs = [], indeces = [], start = count;
View keybase.md

Keybase proof

I hereby claim:

  • I am martin-wiseweb on github.
  • I am martin_wiseweb (https://keybase.io/martin_wiseweb) on keybase.
  • I have a public key ASCmHrOA_f3VZo03WyK8764No_hNiKv2fRpeFVnShigBTwo

To claim this, I am signing this object:

@martin-sweeny
martin-sweeny / gist:c66cf1acd92e91949b8d3ad65c889ec9
Created Feb 9, 2017 — forked from belsrc/gist:672b75d1f89a9a5c192c
Simple Vue.js filters that I usually need
View gist:c66cf1acd92e91949b8d3ad65c889ec9
/**
* Changes value to past tense.
* Simple filter does not support irregular verbs such as eat-ate, fly-flew, etc.
* http://jsfiddle.net/bryan_k/0xczme2r/
*
* @param {String} value The value string.
*/
Vue.filter('past-tense', function(value) {
// Slightly follows http://www.oxforddictionaries.com/us/words/verb-tenses-adding-ed-and-ing
var vowels = ['a', 'e', 'i', 'o', 'u'];
View Singleton.js
/**
* Example Singleton constructor.
* I wish this was extendable but you gotta copy/paste the 2 lines into any object you want to be a Singleton
*
* @returns {*}
* @constructor
*/
function Singleton () {
if ( arguments.callee._singletonInstance ) return arguments.callee._singletonInstance;
arguments.callee._singletonInstance = this;
@martin-sweeny
martin-sweeny / jquery.countup.js
Created May 8, 2016
A miniscule plugin to allow an element to "count up" to a number
View jquery.countup.js
$.fn.countUp = function(timing) {
var max = parseInt(this.text());
if ( !max ) return false;
var i = 0;
var $this = this;
var delay = timing / max ;
var intv = setInterval(function() {
$this.text(i);
if (i === max) return clearInterval(intv);
i++;
You can’t perform that action at this time.