This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function transpose(array) { | |
// split rows | |
array = array.map(r=>r.split('')); | |
// transpose | |
array = array[0].map((r, i)=> array.map(c=>c[i])); | |
// merge rows | |
return array.map(r=> r.join('')); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import unicode_literals, print_function | |
import spacy | |
import json | |
from spacy.matcher import PhraseMatcher | |
from spacy.tokens import Doc, Span, Token | |
import gi | |
gi.require_version('Gst', '1.0') | |
from gi.repository import GObject, Gst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
<rss version="2.0"> | |
<channel> | |
<title>![CDATA[ BW - Welcome Center - Content ]]</title> | |
<link>http://rootdcs.rootintegration.com/carouselapi/v1/zones/107/syndication</link> | |
<description>Provides a list of active bulletins on your Carousel system.</description> | |
<language>en-us</language> | |
<publicationDate>Tue, 22 May 2018 10:05:35 GMT</publicationDate> | |
<copyright>Copyright 2018 Tightrope Media Systems, Inc.</copyright> | |
<item> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function reducerFactory(fieldReducers) { | |
return function formReducer(state={}, action) { | |
if (/UPDATE_/.test(action.type) { | |
// validate field change | |
var [form, field] = /UPDATE_{[a-z]}_{[a-z}/.match(action.type); | |
if (state[form][field]) { | |
return { | |
...state, | |
[form]: { | |
...state[form], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetch('http://files.olo.com/pizzas.json') | |
.catch(e=>console.error(e.message)) | |
.then(r=>r.json()) | |
.then((sales)=>sales.reduce((totals, sale)=>{ | |
var topCombo = sale.toppings.join(' - '); | |
if (totals[topCombo] > 0) totals[topCombo]++; | |
else totals[topCombo] = 1; | |
return totals; | |
},{})) | |
.then(r=>Object.keys(r).map(toppings=>{ return { toppings:toppings, total: r[toppings] }})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CatalogItem { | |
name = 'CATALOGITEM' | |
constructor(item) { | |
Object.assign(this, { | |
...item, | |
...item.Attributes.map(a => a.ExpandedAttributeName.split(' : ')).reduce((o, a) => { o[a[0]] = a[1]; return o; }, {}), | |
Currency: 'USD' | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CatalogItem { | |
name = 'CATALOGITEM' | |
constructor(item) { | |
Object.assign(this, { | |
...item, | |
...item.Attributes.map(a => a.ExpandedAttributeName.split(' : ')).reduce((o, a) => { o[a[0]] = a[1]; return o; }, {}), | |
Currency: 'USD' | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function CourseCatalogBody({ gridOnly, gotoDetails, items, view, toggleCourse, purchaseCourses }) { | |
if (view === 'table' && gridOnly != 'true') { | |
return <CoursesTable items={items} gotoDetails={gotoDetails} toggleCourse={toggleCourse} purchaseCourses={purchaseCourses} />; | |
} | |
return <CoursesGrid items={items} gotoDetails={gotoDetails} />; | |
} | |
function factory(View, inject, dispatch) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<script src="https://fb.me/react-0.14.0.min.js"></script> | |
<script src="https://fb.me/react-dom-0.14.0.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.0.4/redux.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-redux/4.0.0/react-redux.min.js"></script> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var https = require('https'); | |
var request = require('request-promise'); | |
var Promise = require("bluebird"); | |
/** | |
* Pass the data to send as `event.data`, and the request options as | |
* `event.options`. For more information see the HTTPS module documentation | |
* at https://nodejs.org/api/https.html. |
NewerOlder