Skip to content

Instantly share code, notes, and snippets.

View sentientmonkey's full-sized avatar

Scott Windsor sentientmonkey

View GitHub Profile
function* eachSlice(array, size) {
for(let current=0; current < array.length; current+=size) {
yield array.slice(current, current+size);
}
}
const slice = eachSlice([1,2,3,4,5], 2);
for (let value of slice) {
console.log(value);
}
plugins {
id 'org.springframework.boot' version '2.2.2.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'java'
}
repositories {
mavenCentral()
}
./day05.rb day05.txt
11108
Measure Mode: wall_time
Thread ID: 70124925349400
Fiber ID: 70124933569380
Total: 0.667235
Sort by: self_time
%self total self wait child calls name
62.45 0.417 0.417 0.000 0.000 30543 Array#insert
/day05.rb day05.txt
11108
Measure Mode: wall_time
Thread ID: 70249290657280
Fiber ID: 70249290978880
Total: 21.966265
Sort by: self_time
%self total self wait child calls name
98.57 21.652 21.652 0.000 0.000 49990 String#chars
d exception is java.lang.IllegalStateException: No instances available for localhost] with root cause
java.lang.IllegalStateException: No instances available for localhost
at org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient.execute(RibbonLoadBalancerClient.java:75) ~[spring-cloud-netflix-core-1.4.4.RELEASE.jar!/:1.4.4.RELEASE]
at org.springframework.cloud.client.loadbalancer.LoadBalancerInterceptor.intercept(LoadBalancerInterceptor.java:55) ~[spring-cloud-commons-1.3.3.RELEASE.jar!/:1.3.3.RELEASE]
at org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:86) ~[spring-web-4.3.11.RELEASE.jar!/:4.3.11.RELEASE]
at org.springframework.cloud.netflix.metrics.MetricsClientHttpRequestInterceptor.intercept(MetricsClientHttpRequestInterceptor.java:64) ~[spring-cloud-netflix-core-1.4.4.RELEASE.jar!/:1.4.4.RELEASE]
at org.springframework.http.client.InterceptingClientHttpRequest$Intercep
import Person from "./person";
describe('a person', () => {
it('should create default', () => {
let person = new Person();
let defaultPerson = new Person({name: "default", address: "default", age: 0});
expect(person).toEqual(defaultPerson);
});
it('should create with parameters', () => {
export default class Person {
public name: string = "default"
public address: string = "default"
public age: number = 0;
public constructor(init:Partial<Person> = {} as Partial<Person>) {
this.name = init.name || this.name;
this.address = init.address || this.address;
this.age = init.age || this.age;
}
#lang racket/base
(require racket/match)
(provide convert-temperature celsius fahrenheit kelvin temperature-value temperature-unit)
(struct celsius (value) #:transparent)
(struct fahrenheit (value) #:transparent)
(struct kelvin (value) #:transparent)
@sentientmonkey
sentientmonkey / Dockerfile
Created April 25, 2017 21:59
libgit2 repro
FROM debian
WORKDIR /home
RUN apt-get update && apt-get install -y build-essential git wget cmake python
RUN wget https://github.com/libgit2/libgit2/archive/v0.25.1.tar.gz
RUN tar xfvz v0.25.1.tar.gz
RUN mkdir -p libgit2-0.25.1/build
RUN cd libgit2-0.25.1/build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local && cmake --build . --target install
#include <stdio.h>
#include "git2.h"
// Build: gcc -o main -lgit2 main.c
void print_error(int error_code, const char *action)
{
const git_error *error = giterr_last();
if (!error_code)
return;