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
#!/usr/bin/env node | |
const solveWith = require('./lib/solve-with') | |
var stall = (input) => { | |
var [N,K] = input.split(' ') | |
var lastChains = []; | |
var curChains = [N]; | |
var ppl = K; | |
while(true) { |
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
#!/usr/bin/env node | |
const solveWith = require('./lib/solve-with') | |
const bigInt = require('jsbn').BigInteger | |
var stall = (input) => { | |
var [N,K] = input.split(' ') | |
// N = new bigInt(N) | |
K = new bigInt(K) |
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
(0/0+"").repeat("7")+ " BatMan!" | |
// "NaNNaNNaNNaNNaNNaNNaN BatMan!" |
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
var path = require('path'); | |
var webpack = require('webpack'); | |
var BUILD_DIR = path.resolve(__dirname, 'src/client/public'); | |
var APP_DIR = path.resolve(__dirname, 'src/client/app'); | |
config = { | |
entry: APP_DIR + '/index.jsx', | |
output: { | |
path: BUILD_DIR, |
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
import React, { Component } from 'react' | |
import moment from 'moment'; | |
import 'react-datepicker/dist/react-datepicker.css'; | |
export class DateInput extends Component{ | |
constructor (props) { | |
super(props); | |
if(this.props.field.value) { | |
this.state = { selectedDate: moment(this.props.field.value) } |
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
const API_PATH = "http://bustime.mta.info/api" | |
const request = require('request') | |
function BusTime(key) { | |
this.key = key; | |
this.where = service('where') | |
this.siri = service('siri') | |
} |
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
export const alphaAndLengthSort = (a,b) => { | |
if(a[0] == b[0]) { // if first character is equal (this is important) | |
return a.length - b.length // compare by length, if equal then | |
|| a.localeCompare(b) // compare by dictionary order | |
}else{ | |
return a.localeCompare(b) | |
} | |
} |
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
/\b([0-9]+\.[0-9]*\b|([0-9]*\.[0-9]+)\b)/ |
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
//normally to pipe a -> b -> c: | |
a.pipe(b).pipe(c) | |
//could also compose pipings, this below is the same as above, (or is it?): | |
a.pipe(b.pipe(c)) | |
//makes more sense when using a variable to define a composed piping instance | |
const bc = b.pipe(c) | |
a.pipe(bc) | |
d.pipe(bc) |
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
const spawn = require('cross-spawn'); | |
const path = require('path') | |
const ls = spawn.sync('npm', ['ls','--json']); | |
const tree = JSON.parse(ls.stdout) | |
const walkDepTree = (tree,cb) => { | |
const deps = tree.dependencies | |
if(deps) { |
OlderNewer