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 lambda = function (str) { | |
var res = str.match(/^\s*([a-z]+(?:\s+[a-z]+)*)\s*\->\s*(.+?)\s*$/); | |
if (!res) { | |
throw new Error('Invalid lambda expression'); | |
} | |
var args = res[1].replace(/\s{2,}/g, ' ').split(' ') | |
, body = 'return ' + res[2] + ';'; | |
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
(defun cole-foo-balls (beg end r) | |
(interactive "r\nsReplace sel. with: ") | |
(let ((s (if (use-region-p) | |
(buffer-substring-no-properties beg end) | |
(word-at-point)))) | |
(progn | |
(goto-char 0) | |
(replace-regexp s r)))) |
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
#ifndef BOLT_SUBPROCESS_HARNESS_HPP | |
#define BOLT_SUBPROCESS_HARNESS_HPP | |
#include <gtest/gtest.h> | |
#include <glog/logging.h> | |
#include <folly/Subprocess.h> | |
#include <folly/String.h> | |
#include <fstream> | |
#include <vector> | |
#include <string> | |
#include <algorithm> |
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
auto socket_ = TAsyncSocket::newSocket(ev_, super::address()); | |
std::shared_ptr<HeaderClientChannel> channel | |
= HeaderClientChannel::newChannel(socket_); | |
auto client_ = std::make_shared<ClientType>(channel); | |
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
case class State[S, A](runState: S => (A, S)) { | |
def flatMap[B](f: A => State[S, B]): State[S, B] = State({ | |
s: S => | |
val (res, s1) = runState(s) | |
f(res).runState(s1) | |
}) | |
def >>=[B](f: A => State[S, B]): State[S, B] = flatMap(f) | |
def >>[B](f: State[S, B]): State[S, B] = flatMap({ _ => f }) |
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
#!/bin/bash | |
concord kill --zookeeper-hosts localhost:2181 --zookeeper-path /bolt --task-id $1 |
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
#pragma once | |
#include <chrono> | |
#include <concord/time_utils.hpp> | |
namespace bolt { | |
class SnowflakeWorker { | |
public: | |
SnowflakeWorker(const uint8_t datacenterId, const uint8_t workerId) | |
: datacenterId_(datacenterId), workerId_(workerId) {} |
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
// feel free to add a `namespace` annotation here for your chosen language | |
namespace py concord.pubsub | |
namespace rb Concord.PubSub | |
namespace cpp concord.pubsub | |
namespace java concord.pubsub | |
service PubSubBroker { | |
// subscribe / unsubscribe a new consumer to a topic | |
void subscribe(1:string topic, 2:string host, 3:i32 port); | |
void unsubscribe(1:string topic, 2:string host, 3:i32 port); |
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 curry = function (f, args, binding) { | |
if (typeof f !== 'function' || | |
toString.call(args) !== '[object Array]') { | |
throw new Error('Invalid parameters'); | |
return; | |
} | |
if (typeof binding !== 'object') { | |
binding = this; | |
} |
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
$data['trackList'] = array( | |
(object) array( | |
'track_num' => 1, | |
'track_title' => 'You\'re No Good (feat. Santigold, Vybz Kartel, Danielle Haim & Yasmin)', | |
'track_time' => '4:32' | |
), | |
(object) array( | |
'track_num' => 2, | |
'track_title' => 'You\'re No Good (feat. Santigold, Vybz Kartel, Danielle Haim & Yasmin)', | |
'track_time' => '5:35' |
OlderNewer