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 zx | |
const k8sConfigPath = requiredString(argv, 'config') | |
process.env.KUBECONFIG = path.resolve(__dirname, k8sConfigPath) | |
const targets = argv._ | |
const manifests = targets.flatMap((filePath) => { | |
return YAML.parseAllDocuments(fs.readFileSync(filePath).toString()).map((doc) => ({ | |
file: filePath, manifest: doc.toJSON(), |
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
# frozen_string_literal: true | |
require 'bundler/inline' | |
gemfile(true) do | |
source 'https://rubygems.org' | |
gem 'activerecord' | |
gem 'sqlite3' | |
end |
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
# frozen_string_literal: true | |
require 'json' | |
circle_token = ENV.fetch('CIRCLE_CI_USER_TOKEN') | |
workflow_id = ENV.fetch('CIRCLE_WORKFLOW_ID') | |
result = JSON.parse `curl -u #{circle_token}: https://circleci.com/api/v2/workflow/#{workflow_id}` | |
pipeline_id = result['pipeline_id'] | |
workflows = JSON.parse `curl -u #{circle_token}: https://circleci.com/api/v2/pipeline/#{pipeline_id}/workflow` | |
deploy_workflow = workflows.select { _1['name'] == 'deploy' } |
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
# frozen_string_literal: true | |
require 'bundler/inline' | |
gemfile(true) do | |
source 'https://rubygems.org' | |
gem 'activerecord' | |
gem 'sqlite3' | |
end |
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
require 'optparse' | |
class Cli | |
def initialize | |
@opts = {} | |
@available_commands = %w[foo] | |
OptionParser.new do |parser| | |
parser.banner = "Usage: cli" | |
parser.on('-d', '--dry-run', 'Dry run') |
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
# frozen_string_literal: true | |
# ref: https://stackoverflow.com/questions/1461286/advanced-java-like-enums-in-ruby | |
class MyEnum | |
attr_accessor :value | |
def initialize(value) | |
@value = value | |
freeze | |
end |
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 readline from 'readline'; | |
import minimist from 'minimist'; | |
import { exec, ExecOptions } from 'child_process'; | |
function getLogTimeString() { | |
const now = new Date(); | |
const formatter = new Intl.DateTimeFormat('ja-JP', { | |
year: 'numeric', | |
month: '2-digit', | |
day: '2-digit', |
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
type Cons<X, XS extends any[]> = ((h: X, ...args: XS) => void) extends (...args: infer R) => void ? R : []; | |
class PathBuilder<T extends [] | [string, ...string[]] = []> { | |
add<P extends string>(path: P): PathBuilder<Cons<P, T>> { | |
return this as any; | |
} | |
build(): Path<T> { | |
return new Path(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
/* eslint-disable */ | |
import path from 'path'; | |
import { CallExpression, MethodDeclaration, Node, Project, SourceFile, TypeGuards } from 'ts-morph'; | |
function createProject() { | |
return new Project({ tsConfigFilePath: path.join(process.cwd(), 'tsconfig.json') }); | |
} | |
// entory point |
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 { useAppActions } from 'hooks/useAppDispatch'; | |
import React, { useEffect } from 'react'; | |
export const Component = () => { | |
// ActionCreatorの集合を持ったオブジェクトを渡すとdispatch関数にラップされて返ってくる | |
const { initialize } = useAppActions(componentAggregate.creators); | |
useEffect(() => { | |
initialize(); | |
}, [initialize]); |
NewerOlder