Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am simon-lang on github.
  • I am simonlang (https://keybase.io/simonlang) on keybase.
  • I have a public key ASDYTou6XNqXxLThey3kcC4CDJR3RJytbjda5HOutDNdywo

To claim this, I am signing this object:

@simon-lang
simon-lang / fields of use outliers.js
Created September 4, 2017 02:11
fields of use outliers
let max = 0
let maxes = []
vm.items.forEach(item => {
let _max = Math.max.apply(Math, item.data.fieldsOfUse['Relative Lens Metric by Field of Use'])
maxes.push(_max)
if (_max > max) max = _max
if (_max > 30) {
console.warn(item.user.displayName, _max)
}
})
@simon-lang
simon-lang / elasticsearch.js
Last active August 22, 2017 23:00
elastic search angular service.js
require('elasticsearch-browser/elasticsearch.angular')
const app = window.angular.module('lens-ui', ['elasticsearch'])
app.service('elasticClient', ['esFactory', esFactory => {
return esFactory({
host: 'localhost:9200',
})
}])
{
"name": "Example",
"description": "Line 1\nLine2\nThird line with \"quotation marks\""
}
const imageToAscii = require('image-to-ascii')
const argv = require('yargs').argv
const fs = require('fs')
const files = fs.readdirSync('./').filter(f => f.includes('.jpg') || f.includes('.png'))
let index = 0
const tick = () => {
imageToAscii(files[index], (err, converted) => console.log(err || converted))
if (++index >= files.length) {
@simon-lang
simon-lang / zoom-map.js
Created July 4, 2017 23:07
zoom-map.js
const MIN_ZOOM = 1
const MAX_ZOOM = 15
const ZOOM_INCREMENT = 2
function zoomed() {
s = zoom.scale()
g.attr('transform', 'translate(' + zoom.translate() + ')scale(' + zoom.scale() + ')')
@simon-lang
simon-lang / citation-tooltip-hack.js
Created April 17, 2017 23:42
citation-tooltip-hack.js
item.citationList.forEach(x => {
x.tooltipOptions = _.extend(_.clone(window.tooltipsterConfig), {
contentAsHTML: true,
interactive: true,
content: `
<ul>
<li ng-if="citation.doi">
<a ng-href='https://www.lens.org/lens/search?q=citation_id:("{{citation.doi}}")'>
<em class="fa fa-search"></em>
Search in LENS for Patents that cite this paper
@simon-lang
simon-lang / wikipedia-samples.json
Created March 29, 2017 01:08
intro paragraphs from wikipedia for top 500 universities
[{
"institution": "Harvard University",
"collectionId": 8590,
"url": "https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro=&explaintext=&redirects=1&titles=Harvard University",
"intro": "Harvard is a large, highly residential research university. The nominal cost of attendance is high, but the University's large endowment allows it to offer generous financial aid packages. It operates several arts, cultural, and scientific museums, alongside the Harvard Library, which is the world's largest academic and private library system, comprising 79 individual libraries with over 18 million volumes. Harvard's alumni include eight U.S. presidents, several foreign heads of state, 62 living billionaires, 359 Rhodes Scholars, and 242 Marshall Scholars. To date, some 130 Nobel laureates, 18 Fields Medalists, and 13 Turing Award winners have been affiliated as students, faculty, or staff."
},
{
"institution": "Stanford University",
"collectionId": 8634,
"url": "https://en.wikipedia
@simon-lang
simon-lang / Universities AnalysisView.js
Last active March 28, 2017 22:56
Universities AnalysisView.js
// AnalysisView proof of concept for Top500Universities data
// Would need heavy refactoring
// - should really be by patent count, not just who is in the top 500
// - would need "Other" for the rest of the world. This is misleading.
// To get this functioning:
// "highcharts-ng": "^1.1.0",
// <highchart ng-if="!loading" id="chart1" config="chartConfig"></highchart>