Skip to content

Instantly share code, notes, and snippets.

View ryohey's full-sized avatar
👶

ryohey ryohey

👶
View GitHub Profile
@andormade
andormade / main.c
Created November 12, 2011 18:00
Audio Queue example
#include <stdlib.h>
#include <math.h>
#include <AudioToolbox/AudioQueue.h>
#include <CoreAudio/CoreAudioTypes.h>
#include <CoreFoundation/CFRunLoop.h>
#define NUM_CHANNELS 2
#define NUM_BUFFERS 3
@vaiorabbit
vaiorabbit / Building libglfw.dylib on macOS (Apple Silicon)
Last active September 8, 2022 13:10
Building libglfw.dylib on macOS (Apple Silicon)
$ curl -L https://github.com/glfw/glfw/releases/download/3.3.2/glfw-3.3.2.zip > glfw-3.3.2.zip
$ unzip glfw-3.3.2.zip
$ cd glfw-3.3.2/
$ mkdir build
$ cd build
$ export MACOSX_DEPLOYMENT_TARGET=10.14
$ cmake -D CMAKE_BUILD_TYPE=Release -D GLFW_NATIVE_API=1 -D CMAKE_OSX_ARCHITECTURES="x86_64;arm64" -D BUILD_SHARED_LIBS=ON -D CMAKE_C_COMPILER=clang ../
$ make
$ ls -l src/libglfw*
@pyrtsa
pyrtsa / gist:6213784
Created August 12, 2013 18:46
When installing Haskell Platform fails on Mac OS X (with quick fix below)

When installing Haskell Platform fails on Mac OS X (with quick fix below)

I was fighting with Haskell last weekend. At first, I couldn't install some missing libraries with Cabal, and then, when trying to find out what's wrong, I ended up removing the whole Haskell installation — only to find out I could no longer install neither the Haskell Platform nor even just Cabal Install! The warnings I would see were more or less about the use of the single quote in source code:

Preprocessing library text-0.11.2.3...

Data/Text.hs:6:52:
     warning: missing terminating ' character [-Winvalid-pp-token]

-- Copyright : (c) 2009, 2010, 2011, 2012 Bryan O'Sullivan,

@WarrenWeckesser
WarrenWeckesser / wavio.py
Last active January 7, 2023 17:21
**UPDATE** I'm now maintaining this Python module in a regular github repository at https://github.com/WarrenWeckesser/wavio
# wavio.py
# Author: Warren Weckesser
# License: BSD 3-Clause (http://opensource.org/licenses/BSD-3-Clause)
import wave
import numpy as np
def _wav2array(nchannels, sampwidth, data):
"""data must be the string containing the bytes from the wav file."""
@bunnyhero
bunnyhero / ReusableCellExample.m
Last active February 19, 2022 02:04
Example of Reactive Cocoa binding for a reusable cell.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell =
[tableView dequeueReusableCellWithIdentifier:REUSABLE_CELL_ID];
UILabel *label = (UILabel *)[cell viewWithTag:VIEW_TAG];
Model *someModel = [self getModelFromIndexPath:indexPath];
// `takeUntil:` makes the RACObserve() signal complete (and thus breaks the subscription)
// when the cell is recycled.
@quark-zju
quark-zju / lodash.hpp
Last active February 5, 2020 02:14
Little C++ header inspired by Ruby and Lo-dash
// compile with -std=c++1y
#include <algorithm>
#include <functional>
#include <iterator>
#include <vector>
namespace LoDash {
using std::begin;
@NathanSweet
NathanSweet / Photoshop-LayersToPNG.jsx
Last active November 7, 2023 04:09
Adobe Photoshop script to export to Esoteric Software's Spine: http://esotericsoftware.com/
Please note this script has moved: https://github.com/EsotericSoftware/spine-scripts
@ykst
ykst / gist:8557e2ce9280111c41b6
Created January 28, 2015 14:11
glsl-optimizerでGLSLのオフライン最適化を行う

glsl-optimizerでGLSLのオフライン最適化を行う

OpenGLにコンパイルしてもらう時点でシェーダにはある程度最適化が行われるようですが、 モバイルデバイスではあまりコストの掛かる最適化は行われないだろうという事で、 オフラインでGLSLの最適化をしてくれるフレームワークとしてglsl-optimizerがあります。 サポートされているGLSLバージョンはES2.0とES3.0もカバーしていますが、未対応の拡張もあります。

元々はUnityが機械生成した冗長なGLSLを最適化するために作られたようですが、 一応手書きのシェーダの最適化に使うこともできます。 ただし、組み込みを前提としているようでコマンドラインからキックするバイナリは提供されていません。

@onmyway133
onmyway133 / TextViewHighlighter.m
Last active February 3, 2019 22:52
TextViewHighlighter
// SO [UITextView - Highlight text with NSBackgroundColor - exclude line breaks](http://stackoverflow.com/questions/26558396/uitextview-text-highlighting-when-the-text-is-centered)
// Source
// TextViewHighlighter.h
#import <Foundation/Foundation.h>
@import UIKit;
@interface TextViewHighlighter : NSObject
@fliedonion
fliedonion / !GIST file list order - summary.md
Last active May 11, 2024 12:14
Understand GIST file list order.
Summary How to control (or Understand) your GIST page's files list order.
Notice not official documentation.