Skip to content

Instantly share code, notes, and snippets.

View kbinani's full-sized avatar

kbinani kbinani

View GitHub Profile
import Foundation
class A {
private enum B {
case one
case two(IndexPath)
case three(IndexPath, Int)
}
private var b: B = .one
// NG
func copyTextTab(_ style: CTParagraphStyle) -> [CTTextTab] {
var tabStops: CFArray!
guard CTParagraphStyleGetValueForSpecifier(style, .tabStops, MemoryLayout<CFArray>.size, &tabStops) else {
return []
}
return (tabStops as NSArray)
.filter({ (tab) -> Bool in CFGetTypeID(tab as CFTypeRef) == CTTextTabGetTypeID() })
.map({ (it) -> CTTextTab in
let tab = it as! CTTextTab
enum CGContextType : Int {
case unknown
case pdf
case postscript
case window
case bitmap
case gl
case displaylist
case kseparation
case iosurface
@kbinani
kbinani / test.md
Last active February 5, 2018 06:28
  • aaaa
    • aaaaaaaa
      • aaa
        • aa
          • bb
  • aaa
/* CGSPrivate.h -- Header file for undocumented CoreGraphics stuff. */
/* DesktopManager -- A virtual desktop provider for OS X
*
* Copyright (C) 2003, 2004 Richard J Wareham <richwareham -at- users -d0t- sourceforge -dot- net>
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
#include <type_traits>
//! Implementation of cexpr_exp_less_than_1.
template <class FloatType, class = std::enable_if<std::is_floating_point<FloatType>::value>>
FloatType constexpr constexpr_exp_less_than_1_impl(FloatType x, FloatType answer, FloatType xn, FloatType factorial, size_t n)
{
FloatType next_answer = answer + xn / factorial;
if (answer == next_answer) {
return answer;
}
// https://github.com/gemini-testing/png-img
'use strict;'
var PngImg = require('png-img');
function save(pixel_data, width, height, file_path) {
// init with 1x1 PNG buffer.
var tmp = new PngImg(new Buffer([137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 0, 1, 0, 0, 0, 1, 8, 2, 0, 0, 0, 144, 119, 83, 222, 0, 0, 0, 1, 115, 82, 71, 66, 0, 174, 206, 28, 233, 0, 0, 0, 12, 73, 68, 65, 84, 8, 29, 99, 96, 96, 96, 0, 0, 0, 4, 0, 1, 100, 50, 83, 254, 0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130]));
tmp.setSize(width, height);
var idx = 0;
var color = {};
#ifdef _MSC_VER
#define NOMINMAX
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <tlhelp32.h>
#else
#include <pthread.h>
#endif
#include <memory>
@kbinani
kbinani / install.bat
Last active January 13, 2017 00:45
Register login-time schedule to disable console beep
schtasks /Create /XML net_stop_beep.xml /TN net_stop_beep
project(rubberband)
cmake_minimum_required(VERSION 2.8)
file(GLOB rubberband_src
"src/audiocurves/*.*"
"src/base/*.*"
"src/dsp/*.*"
"src/float_cast/*.*"
"src/kissfft/*.*"
"src/pommier/*.*"