Skip to content

Instantly share code, notes, and snippets.

View Ben52's full-sized avatar
🎯
Focusing

Binyomin Greenes Ben52

🎯
Focusing
View GitHub Profile
@Ben52
Ben52 / download-file.js
Created August 15, 2018 19:39 — forked from Tomassito/download-file.js
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
link.click();

Keybase proof

I hereby claim:

  • I am ben52 on github.
  • I am bengie (https://keybase.io/bengie) on keybase.
  • I have a public key ASBEq4HYtYrmod-lKq3bISGJ0N7Mii0md1Wf06voo91F6Qo

To claim this, I am signing this object:

@Ben52
Ben52 / dateRange.js
Created September 7, 2017 19:52
Get range of dates
const moment = require('moment');
function getRangeOfDates(start, end, key, arr = [start.startOf(key)]) {
if(start.isAfter(end)) throw new Error('start must precede end')
const next = moment(start).add(1, key).startOf(key);
if(next.isAfter(end, key)) return arr;

The Why and When of Choosing Elm

What is Elm?

  • Language (and "framework") for building web frontend applications
  • Can be used in place of HTML, CSS and JavaScript
  • Compiles into the above
@Ben52
Ben52 / introrx.md
Created September 19, 2016 17:00 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@Ben52
Ben52 / fibonacci sequence
Created July 26, 2016 01:33
simple fibonacci function
function fb(steps, series = [], current = 1, last = 0) {
if(steps === 0) return series.reduce((a, b) => a + b);
return fb(--steps, series.concat(current), current + last, current)
}