Skip to content

Instantly share code, notes, and snippets.

View magicien's full-sized avatar
😴
Having a doze

magicien magicien

😴
Having a doze
View GitHub Profile
@magicien
magicien / EOSSDK_module.map
Created May 24, 2020 12:07
module.map for Epic Online Services SDK (libEOSSDK-Mac-Shipping.dylib)
module EOSSDK {
umbrella "Headers"
export *
module * { export * }
}
@magicien
magicien / eos_login_sample.swift
Created May 24, 2020 10:23
Epic Online Services Log in sample for Swift
import QuartzCore
import EOSSDK
var platformHandle: EOS_HPlatform? = nil
var displayLink: CVDisplayLink? = nil
func logFunc(message: Optional<UnsafePointer<_tagEOS_LogMessage>>) {
message?.withMemoryRebound(to: EOS_LogMessage.self, capacity: 100) {
let str = String(cString: $0.pointee.Message, encoding: .ascii)
Swift.print(str ?? "")
@magicien
magicien / CMakeLists.txt.after
Created May 19, 2020 18:10
EOSサンプル修正後の CMakeLists.txt
#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()
@magicien
magicien / compare_array_filter_performance.js
Last active April 15, 2020 18:45
Comparing performance to filter items of an array in JavaScript
// 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);
}
@magicien
magicien / checkout.sh
Last active December 11, 2019 10:36
chruby-disabled checkout script for CircleCI
#!/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
@magicien
magicien / Swift4_JSON_09.swift
Created October 3, 2017 00:54
How should I inherit Codable class?
import Foundation
let json = """
{
"a": 1,
"b": 2,
"c": 3
}
""".data(using: .utf8)!
import Foundation
// framework側のコード
let ExtensionKey = CodingUserInfoKey(rawValue: "extensionKey")!
struct Group: Codable {
let users: [User]
}
import Foundation
let json = """
{
"user_id": 1,
"user_name": "magicien",
"friends": [
{
"user_id": 2,
"is_best_friend": true
import Foundation
let json = """
[
{ "name": "magicien" },
{ },
{ "name": "NoName" }
]
""".data(using: .utf8)!
import Foundation
let json = """
{
"user_id": 1,
"user_name": "magicien",
"friends": [
{
"user_id": 2,
"is_best_friend": true