Skip to content

Instantly share code, notes, and snippets.

export function tuple<T1, T2>(t1: T1, t2: T2): [T1, T2] {
return [t1, t2];
}
export type Func<T, R> = (t: T) => R;
export type KeyValuesPair<K, V> = [K, V[]];
export const groupBy = Symbol();
export const toMapBy = Symbol();
@masaedw
masaedw / samplestack.ts
Created June 11, 2020 07:23
State 'task3' already has a next state
import cdk = require("@aws-cdk/core");
import sfn = require("@aws-cdk/aws-stepfunctions");
import { Duration } from "@aws-cdk/core";
export class SampleStack extends cdk.Stack {
constructor(app: cdk.App, id: string, props?: cdk.StackProps) {
super(app, id, props);
const task1 = new sfn.Wait(this, "task1", {
time: sfn.WaitTime.duration(Duration.minutes(1)),

この記事は NewsPicks Advent Calendar 2018 の3日目の記事です。

はじめまして

NewsPicksで働いている masa_edw です。

入社後一ヶ月経ったばかりで技術的には何か言えるほどのことをまだしておらず、サービスや会社のことについて語るのもおこがましかろうということで、自分語りをします。

経歴など

@masaedw
masaedw / react-redux.d.ts
Created March 28, 2018 06:07
react-redux.d.ts for redux@4.0.0-beta.2
// Type definitions for react-redux 5.0.8
// Project: https://github.com/rackt/react-redux
// Definitions by: Qubo <https://github.com/tkqubo>,
// Thomas Hasner <https://github.com/thasner>,
// Kenzie Togami <https://github.com/kenzierocks>,
// Curits Layne <https://github.com/clayne11>
// Frank Tan <https://github.com/tansongyang>
// Nicholas Boll <https://github.com/nicholasboll>
// Dibyo Majumdar <https://github.com/mdibyo>
// Prashant Deva <https://github.com/pdeva>
@masaedw
masaedw / TestDbAsyncQueryProvider.cs
Created August 19, 2017 07:55
TestDbAsyncQueryProvider fixed to use with AutoMapper's ProjectTo
// TestDbAsyncQueryProvider from https://msdn.microsoft.com/en-us/library/dn314429(v=vs.113).aspx
internal class TestDbAsyncQueryProvider<TEntity> : IDbAsyncQueryProvider
{
private readonly IQueryProvider _inner;
internal TestDbAsyncQueryProvider(IQueryProvider inner)
{
_inner = inner;
}
#!/bin/bash
name=$1
dir=$(basename $name .jpg)
if [[ ! -d $dir ]]; then
mkdir $dir
fi
for i in 1040 1024 700 460 300 240; do
@masaedw
masaedw / hoge.rb
Last active January 1, 2016 05:29
module Isono
class Namihe
end
end
class Isono::Wakame
Namihe #=> NameError: uninitialized constant Isono::Wakame::Namihe
end
module Isono
require 'sinatra/base'
require 'sequel'
$LOAD_PATH << "."
autoload :Post, "post"
class MyApp < Sinatra::Base
configure do
DB = Sequel.connect("sqlite://sample.db")
end
end
@masaedw
masaedw / jquery.validate.unobtrusive.js
Created June 12, 2013 08:33
data-val-remoteでAdditionalFieldsを設定したときにラジオボタンの値が正しくとれてない
adapters.add("remote", ["url", "type", "additionalfields"], function (options) {
var value = {
url: options.params.url,
type: options.params.type || "GET",
data: {}
},
prefix = getModelPrefix(options.element.name);
$.each(splitAndTrim(options.params.additionalfields || options.element.name), function (i, fieldName) {
var paramName = appendModelPrefix(fieldName, prefix);
@masaedw
masaedw / fizzbuzz.pudding
Last active December 13, 2015 18:49
a fizzbuzz implementation written in pudding
: succ 1 + ;
: drop2 drop drop ;
: mod=0 mod 0 == ;
: fb' dup 15 mod=0 if "fizzbuzz" . else dup 5 mod=0 if "buzz" . else dup 3 mod=0 if "fizz" . else dup . then then then ;
: fb ;
: fb dup2 >= if fb' succ fb else drop2 then ;
100 1 fb