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
let url = URL(fileURLWithPath: pngFileName, relativeTo: directoryPath) | |
// let reddishImage = NSImage(contentsOf: url) | |
let cgDataProvider = CGDataProvider(url: url as CFURL)! | |
let cgImage = CGImage(pngDataProviderSource: cgDataProvider, decode: nil, shouldInterpolate: false, intent: CGColorRenderingIntent.defaultIntent)! | |
let imageSize = CGSize(width: cgImage.width, height: cgImage.height) | |
let correctImage = NSImage(cgImage: cgImage, size: imageSize) |
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 express = require('express') | |
const session = require('express-session') | |
const passport = require('passport') | |
const GitHubStrategy = require('passport-github2').Strategy | |
const clientId = process.env.GITHUB_APP_CLIENT_ID | |
const clientSecret = process.env.GITHUB_APP_CLIENT_SECRET | |
const domainName = process.env.DOMAIN_NAME | |
const app = express() |
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 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 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 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 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 = """ | |
{ | |
"nodes": [ | |
{ | |
"extensions": { | |
"KHR_materials_common": { | |
"light": 0 | |
} |
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
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 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 = """ | |
{ | |
"user_id": 1, | |
"user_name": "magicien", | |
"url": "http://darkhorse2.0spec.jp" | |
} | |
""".data(using: .utf8)! |
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 Foundation | |
let json = """ | |
{ | |
"user_id": 1, | |
"user_name": "magicien", | |
"friends": [ | |
{ | |
"user_id": 2, | |
"is_best_friend": true |
OlderNewer