This file contains hidden or 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
| #!/bin/bash | |
| notebook_files=$(git diff --cached --name-only | grep -E '\.ipynb$') | |
| if [ -n "$notebook_files" ] | |
| then | |
| source ./notebook/venv/bin/activate || exit | |
| for file in $notebook_files | |
| do |
This file contains hidden or 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
| describe("n queens", function() { | |
| var isSafe = R.curry((col, placedQueens) => { | |
| var row = R.length(placedQueens); | |
| var notThreatened = ([r, c]) => col !== c && Math.abs(col - c) !== row - r; | |
| var rowsWithQueen = R.zip(R.reverse(R.range(0, row)), placedQueens); | |
| return R.all(notThreatened, rowsWithQueen); | |
| }); | |
| var queens = (n) => { | |
| var columns = R.range(0, n); |
This file contains hidden or 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! OmniSharp#RunTests(mode) abort | |
| wall | |
| python buildcommand() | |
| if a:mode !=# 'last' | |
| python getTestCommand() | |
| endif | |
| let s:cmdheight=&cmdheight | |
| set cmdheight=5 |
This file contains hidden or 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
| var Rx = require('rx'); | |
| var _ = require('lodash'); | |
| var defaultOptions = { | |
| minWidth: 1050, | |
| containerRefName: 'container' | |
| }; | |
| module.exports = function(options) { | |
| return { |
This file contains hidden or 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
| var _ = require('lodash'); | |
| module.exports.apply = function lodashFlatMapMixin() { | |
| function flatMap (array, selector) { | |
| return [].concat.apply([], array.map(selector)); | |
| }; | |
| _.mixin({flatMap: flatMap}, {chain: true}); |
This file contains hidden or 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
| var spawn = require('child_process').spawn; | |
| var eventStream = require('./event-stream'); | |
| var compose = require('koa-compose'); | |
| //get username / password from somewhere | |
| var username = ...; | |
| var password = ...; | |
| var credential = username + ':' + password; | |
| //8 hour timeout |
This file contains hidden or 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
| module.exports = function eventStream() { | |
| return function *(next) { | |
| this.req.setTimeout(0); //no timeout | |
| this.type ='text/event-stream; charset=utf-8'; | |
| this.set('Cache-Control', 'no-cache'); | |
| this.set('Connection', 'keep-alive'); | |
| this.set('Transfer-Encoding', 'chunked'); | |
| yield* next; | |
| } |
This file contains hidden or 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
| var React = require('react'); | |
| var Input = require('react-bootstrap/src/Input'); | |
| var DropdownButton = require('react-bootstrap/src/DropdownButton'); | |
| var _ = require('lodash'); | |
| var escape = /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g; | |
| function escapeRegExp(str) { | |
| return str.replace(escape, "\\$&"); | |
| }; |
This file contains hidden or 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
| var React = require('react'); | |
| var Input = require('react-bootstrap/src/Input'); | |
| var Glyphicon = require('react-bootstrap/src/Glyphicon'); | |
| var _ = require('lodash'); | |
| var Rx = require('rx'); | |
| var canUseDom = require('can-use-dom'); | |
| var changeCase = require('change-case'); | |
| function events(event) { | |
| return canUseDom ? Rx.Observable.fromEvent(document, event) : Rx.Observable.empty; |
This file contains hidden or 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
| var Rx = require('rx'); | |
| var _ = require('lodash'); | |
| module.exports = function(minSeconds, maxSeconds) { | |
| if (minSeconds >= maxSeconds) { | |
| throw new Error('min needs to be less than max'); | |
| } | |
| var getDueTime = () => _.random(minSeconds, maxSeconds) * 1000; |
NewerOlder