Skip to content

Instantly share code, notes, and snippets.

View nimzo6689's full-sized avatar

nimzo6689 nimzo6689

View GitHub Profile
const describe = (desc, fn) => {
console.log(desc)
fn()
}
const it = (msg, fn) => describe(' ' + msg, fn)
const matchers = (exp) => ({
toBe: (asssertion) => {
if (exp === assertion) {

PowerShell Gives You Wrongs

三年半の格闘の末に僕が見たもの、あるいは試行錯誤の覚書、すなわち二番煎じ。

はじめに

PowerShell 3.0以上のバージョンを使用すること。2.0以下のバージョンは、書き捨ては仕方ないとしても、保守対象のスクリプトを書くべきではないし、あらゆる言及に値しない。全力でバージョンアップをしろ。

式と文の常識を超えて

@se35710
se35710 / find-java.ps1
Last active November 25, 2023 18:08
PowerShell script to locate Java on Windows, optionally sets JAVA_HOME and JRE_HOME.
<#
.SYNOPSIS
Locates Java versions and optionally sets JAVA_HOME and JRE_HOME.
.DESCRIPTION
The Find-Java function uses PATH, JAVA_HOME, JRE_HOME and Windows Registry to retrieve installed Java versions.
If run with no options, the first Java found is printed on the console.
.PARAMETER Vendor
Selects Java vendor, currently supports Oracle, OpenJDK and IBM. Defaults to Any.
.PARAMETER Architecture
What processor architecture to match. Valid options are 32, 64, Match and All. Match detects what integer size is used for the PowerShell process, and matches the architecture. If Wow64 is available, 64 bit versions of Java are selected first.
@mike-neck
mike-neck / ArgumentCaptorSample.java
Created June 7, 2016 02:31
テストでstaticメソッドに渡された引数をキャプチャーする
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import java.util.HashMap;
import java.util.Map;
@kakajika
kakajika / flatMap.ts
Created July 3, 2015 18:52
Array.prototype.flatMap method in TypeScript.
interface Array<T> {
flatMap<E>(callback: (t: T) => Array<E>): Array<E>
}
Object.defineProperty(Array.prototype, 'flatMap', {
value: function(f: Function) {
return this.reduce((ys: any, x: any) => {
return ys.concat(f.call(this, x))
}, [])
},
@argius
argius / App.java
Last active October 31, 2022 17:12
Calculator written in Java 8 with JavaFX 8 + SceneBuilder 2.0
package net.argius.calculator;
import java.math.BigDecimal;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.Button;
@rosylilly
rosylilly / gist:3401612
Created August 20, 2012 06:40
先輩と覚える HTTP ステータスコード

先輩に学ぶ HTTP Status Code

超雑にまとめました。修正してください。

登場人物

  • アプリケーション先輩: いつも忙しい。横に広がるのが得意(デブじゃない)。
  • 後輩: 頼んでばっかしで役に立たない。
  • サーバー先輩: アプリケーション先輩と仲がいい。Unix Socket でつながるくらい仲良し。
  • プロクシ先輩: アプリケーション先輩とかサーバー先輩と後輩の間を取り持って代わりに伝えたりしてくれる。たまに勝手にレスポンスを書き換える。
@taichi
taichi / code_reading.md
Last active April 10, 2024 13:04
太一のコードの読み方メモ

太一のコードの読み方メモ

全体として太一が感覚的に実践している事を論理的に説明しようと試みている為、
説明の粒度が適切でなかったり一貫性が無いように見える部分があるかもしれない。
普段やっているけども書ききれていない事も多分きっとある。

コードを読むとは何か

  • コードを嗜む
  • コードを学ぶ
  • 武器を手に入れる