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
| const fs = require('fs'); | |
| const csvWriter = require('csv-write-stream') | |
| const writer = csvWriter({ headers: ["id", "name"]}); | |
| const faker = require('faker'); | |
| writer.pipe(fs.createWriteStream('out.csv')) | |
| for (var i = 1; i < 2000000; i++) { |
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
| private: | |
| StackContextEntry* getFromContext(StackElements element) { | |
| // as we emplace back in the stack, we should find from back to front | |
| for (auto it = m_stack.rbegin(); it != m_stack.rend(); it++) { | |
| if ((*it).elementType == element) { | |
| return &(*it); | |
| } | |
| } | |
| return NULL; | |
| } |
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
| immutable string GenerateVisitMethods = q{ | |
| mixin defaulVisit!(["Document", "Definition", "FragmentDefinition", | |
| "OperationDefinition", "SelectionSet", "Selection", | |
| "Field", "VariableDefinitions", "VariableDefinition", | |
| "Type", "TypeName", "FragmentSpread", "Argument", "Arguments"]); | |
| mixin (defaulVisit); | |
| }; | |
| mixin template defaulVisit(alias name) | |
| { |
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
| import { | |
| XPTOService | |
| } from '../services' | |
| import { loginFailed } from './index.js' | |
| const initial = { | |
| filtering: { | |
| data: [] | |
| }, | |
| listing: {} |
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
| --- | |
| gn: [31, 25, 24, 26, 32, 22, 24, 22, 29, 32, 32, 20, 18, 24, 21, 16, 27, 33, 38, 18, 34, 24, 20, 67, 34, 35, 46, 22, 35, 43, 54, 33, 20, 31, 29, 43, 36, 30, 23, 23, 57, 38, 34, 34, 28, 34, 31, 22, 33, 26] | |
| ex: [22, 25, 22, 31, 23, 30, 29, 28, 35, 29, 10, 51, 22, 31, 27, 36, 16, 27, 25, 26, 37, 30, 33, 18, 40, 37, 21, 43, 46, 38, 18, 35, 23, 35, 35, 38, 29, 31, 43, 38] | |
| lv: [17, 16, 17, 35, 26, 23, 38, 36, 24, 20, 47, 8, 59, 57, 33, 34, 16, 30, 37, 27, 24, 33, 44, 23, 55, 46, 34] | |
| nm: [54, 34, 51, 49, 31, 27, 89, 26, 23, 36, 35, 16, 33, 45, 41, 35, 28, 32, 22, 29, 35, 41, 30, 25, 19, 65, 23, 31, 39, 17, 54, 42, 56, 29, 34, 13] | |
| dt: [46, 37, 29, 49, 33, 25, 26, 20, 29, 22, 32, 31, 19, 29, 23, 22, 20, 22, 21, 20, 23, 29, 26, 22, 19, 19, 26, 69, 28, 20, 30, 52, 29, 12] |
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
| implicit class OrElseHelper[S, Z](from: (S => Future[Option[Z]])) { | |
| // TODO: Verify if this helper is generalized enough to move to a more central generic area. | |
| def orElse(to : (Z => Future[Z]))(s : S)(c : Z): Future[Either[Future[Z],Future[Z]]] = { | |
| from(s) flatMap { | |
| case None => Future.successful(Left(to(c))) | |
| case Some(someValue) => Future.successful(Right(Future.successful(someValue))) | |
| } | |
| } | |
| } |
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
| def delete(groupName: String, teamName: String, seqNumber: Int) = (baseAction andThen authAction) { request => | |
| apiActor ! DeleteCommand(CommandKey(seqNumber, teamName, groupName)) | |
| Ok("Command enqueued for deletion") | |
| } | |
| def delete(command: Future[Command]): Future[Int] = command.flatMap { c => | |
| val q = commands.filter(_.id === c.id).map(_.deleted) | |
| Logger.debug(q.updateStatement) |
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 : Good Node | |
| Description : impl for Hacker Rank | |
| Used at blog post: <http://paulosuzart.github.io/blog/2015/08/21/how-much-functional-are-you/> | |
| -} | |
| module Main( | |
| Node, | |
| NodeSystem, | |
| makeNodeAssoc, |
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
| package com.example | |
| import scala.collection.mutable.HashMap | |
| class Node(idx : Int) { | |
| val index = idx | |
| var pointsTo : Option[Node] = None | |
| var walked = false | |
| override def toString() = s"Node - idx: ${this.index}, points to ${this.pointsTo.get.index}." | |
| } |
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
| //Enter your code here. Read input from STDIN. Print output to STDOUT | |
| def br = new BufferedReader(new InputStreamReader(System.in)) | |
| def lineAsInt(br) { | |
| return Integer.parseInt(br.readLine()) | |
| } | |
| def MAX_T = 20 | |
| def readT(br) { | |
| def t = lineAsInt(br) |