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
@GrabResolver(name = 'jitpack.io', root = 'https://jitpack.io') | |
@Grab('com.github.baloise:rocket-chat-rest-client:master-8a410650b3-1') | |
import com.github.baloise.rocketchatrestclient.* | |
import com.github.baloise.rocketchatrestclient.model.* |
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
const webpack = require("webpack"); | |
const express = require("express"); | |
const MemoryFileSystem = require("memory-fs") | |
// 仮想的にファイルを用意する (cf. https://github.com/webpack/memory-fs) | |
const fs = new MemoryFileSystem() | |
fs.writeFileSync("/index.html", | |
`<h1>My App!</h1><script src="bundle/app.js"></script>`) | |
fs.mkdirpSync("/src") |
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
const stats = [... new Array(1000)].map(it => 0); | |
const makeStat = () => { | |
let result = 0; | |
for (let i = 0; i < 1000; i++) { | |
result += Math.random(); | |
} | |
return result | |
} | |
for (let i = 0; i < 100000; i++) { |
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 React, { useContext } from "react"; | |
const map = new Map<any, any>(); | |
export const createGlobalStore = <T>( | |
key: any, | |
generateStore: (prevStore: T | undefined) => T | |
) => { | |
const store = generateStore(map.get(key)); | |
map.set(key, store); |
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 { getSnapshot, Instance } from "mobx-state-tree"; | |
import { createContext, useEffect, useState } from "react"; | |
import { MyStore } from "./MyStore"; | |
export const useMyStore = () => { | |
const [state, setState] = useState(() => MyStore.create()); | |
useEffect(() => { | |
if ((window as any).reentrant) { | |
const newState = MyStore.create(getSnapshot(state)); |
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 { useEffect, useState } from "react"; | |
const darkModeQuery = matchMedia("(prefers-color-scheme: dark)"); | |
export const useDarkMode = () => { | |
const [isDark, setDark] = useState(darkModeQuery.matches); | |
useEffect(() => { | |
const listener = () => { | |
console.log("Dark mode changed", darkModeQuery.matches); |
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
dest=src/components/atoms/icon/IconTypes.ts | |
cat > $dest <<EOF | |
export type IconTypes = | |
EOF | |
curl 'https://fonts.google.com/metadata/icons' \ | |
| tail -n +2 \ | |
| jq '.icons[].name' \ | |
| perl -e 'print " | " . join " | ", <>' \ |
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
const ldap = require("ldapjs"); | |
const server = ldap.createServer(); | |
server.bind("", (req, res, next) => { | |
console.log(`Bind attempt with ${req.dn.toString()}`); | |
res.end(); | |
return next(); | |
}); |
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
[Unit] | |
Description=Jenkins Slave (for Docker operation) | |
[Service] | |
User=root | |
WorkingDirectory=/opt/jenkinsslave | |
ExecStart=/usr/bin/java -Xmx256m -jar swarm-client.jar -master https://ot-jenkins.ssc-web.net -name du2 -username jenkins -password nicejenkins -fsroot ./jenkinsws -executors 3 -deleteExistingClients -labels "docker webpost4mn-admin-integartion" | |
SuccessExitStatus=143 | |
TimeoutStopSec=10 | |
Restart=on-failure |
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
const formula = [31,28,31,30,31,30,31,31,30,31,30,31].map((e, m) => { | |
m++; | |
const otherMonths = [1,2,3,4,5,6,7,8,9,10,11,12].filter(e => e !== m); | |
return `${e} * (${otherMonths.map(om => `(x-${om})`).join('*')}) / (${otherMonths.map(om => `(${m}-${om})`).join('*')})` | |
}).join("\n + ") | |
// 31 * ((x-2)*(x-3)*(x-4)*(x-5)*(x-6)*(x-7)*(x-8)*(x-9)*(x-10)*(x-11)*(x-12)) / ((1-2)*(1-3)*(1-4)*(1-5)*(1-6)*(1-7)*(1-8)*(1-9)*(1-10)*(1-11)*(1-12)) | |
// + 28 * ((x-1)*(x-3)*(x-4)*(x-5)*(x-6)*(x-7)*(x-8)*(x-9)*(x-10)*(x-11)*(x-12)) / ((2-1)*(2-3)*(2-4)*(2-5)*(2-6)*(2-7)*(2-8)*(2-9)*(2-10)*(2-11)*(2-12)) | |
// + 31 * ((x-1)*(x-2)*(x-4)*(x-5)*(x-6)*(x-7)*(x-8)*(x-9)*(x-10)*(x-11)*(x-12)) / ((3-1)*(3-2)*(3-4)*(3-5)*(3-6)*(3-7)*(3-8)*(3-9)*(3-10)*(3-11)*(3-12)) | |
// + 30 * ((x-1)*(x-2)*(x-3)*(x-5)*(x-6)*(x-7)*(x-8)*(x-9)*(x-10)*(x-11)*(x-12)) / ((4-1)*(4-2)*(4-3)*(4-5)*(4-6)*(4-7)*(4-8)*(4-9)*(4-10)*(4-11)*(4-12)) |
NewerOlder