This file contains hidden or 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 jwt = require('jsonwebtoken') | |
const fetch = require('node-fetch') | |
const appId = process.env.GITHUB_APP_ID | |
const privateKey = process.env.GITHUB_APP_PRIVATE_KEY | |
const getRepositories = (token) => { | |
return fetch('https://api.github.com/installation/repositories', { | |
headers: { | |
Authorization: `token ${token}`, |
This file contains hidden or 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 Foundation | |
import SceneKit | |
let json = """ | |
{ | |
"position": [2.0, 5.0, 3.0], | |
"rotation": [0.0, 0.73, 0.0, 0.73] | |
} | |
""".data(using: .utf8)! |
This file contains hidden or 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 Foundation | |
let json = """ | |
{ | |
"a": 1, | |
"b": 2, | |
"c": 3 | |
} | |
""".data(using: .utf8)! |
This file contains hidden or 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 express = require('express') | |
const fetch = require('node-fetch') | |
const app = express() | |
app.get('/githubapi/repos/:owner/:repo/:ref', (req, res) => { | |
const owner = req.params.owner | |
const repo = req.params.repo | |
const ref = req.params.ref |
This file contains hidden or 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
async function getResult(request) { | |
const promise = new Promise((resolve, reject) => { | |
request.onsuccess = () => { | |
resolve(request.result) | |
} | |
request.onerror = () => { | |
reject(request.error) | |
} | |
}) | |
return promise |
This file contains hidden or 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
public func Cross(_ q1: SCNQuaternion, _ q2: SCNQuaternion) -> SCNQuaternion { | |
return SCNQuaternion( | |
q1.w * q2.x + q1.x * q2.w + q1.y * q2.z - q1.z * q2.y, | |
q1.w * q2.y - q1.x * q2.z + q1.y * q2.w + q1.z * q2.x, | |
q1.w * q2.z + q1.x * q2.y - q1.y * q2.x + q1.z * q2.w, | |
q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z | |
) | |
} |
This file contains hidden or 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
#!/bin/sh | |
set -e | |
# Disable chruby | |
trap - DEBUG || true | |
# Workaround old docker images with incorrect $HOME | |
# check https://github.com/docker/docker/issues/2968 for details | |
if [ "${HOME}" = "/" ] | |
then |
This file contains hidden or 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
// Comparing performance to filter items of an array. | |
// I want to convert array data, but I don't want to include some of the data. | |
const N = 50000; | |
const data = []; | |
for(let i=0; i<N; i++) { | |
data.push(i); | |
} |
This file contains hidden or 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
#CMAKE file for build | |
project (SimpleFramework) | |
cmake_minimum_required(VERSION 2.6) | |
if(NOT CMAKE_BUILD_TYPE) | |
set(CMAKE_BUILD_TYPE Release) #default type is release | |
endif() |