Skip to content

Instantly share code, notes, and snippets.

Yusuke Ito novi

Block or report user

Report or block novi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rsms
rsms / sleeping-barber.m
Created Nov 10, 2010
Sleeping barber with GCD (Grand Central Dispatch)
View sleeping-barber.m
int main (int argc, const char * argv[]) {
dispatch_queue_t waitingChairs = dispatch_queue_create("waitingChairs", 0);
dispatch_queue_t barber = dispatch_queue_create("barber", 0);
dispatch_semaphore_t semaphore = dispatch_semaphore_create(3);
NSInteger ident = 0;
while (++ident) {
if (dispatch_semaphore_wait(semaphore, DISPATCH_TIME_NOW) != 0) {
printf("Customer %d turned away\n", ident);
continue;
}
@rsms
rsms / KVOChangeScope.hh
Created Nov 25, 2010
Conveniently mark Key-Value Observable properties as edited in Objective-C++
View KVOChangeScope.hh
/*
* KVOChangeScope -- Conveniently mark edits for Key-Value Observations in
* Objective-C++ in custom setters.
*
* Example:
*
* - (void)setFoo:(id)value {
* kvo_scoped_change(foo);
* // your setter code here which might return at any moment
* }
@nakiwo
nakiwo / gist:3179598
Created Jul 26, 2012
Xcode4.4 iOS SDKで @yES,@no,array[...],dictionary[...]を使う
View gist:3179598
// Xcode4.4
// llvm4の機能のうち一部が、
// iOS 5.1 SDK で使えない
//
NSNumber *b = @YES; // error
NSArray *array = @[ @1, @2, @3 ];
NSNumber *n = array[1]; // error
@roxlu
roxlu / AudioConverterBrain.cpp
Created May 6, 2016
Example implementation of using the amazing b8brain audio samplerate converter, https://github.com/avaneev/r8brain-free-src This was used for a real time audio stream converter.
View AudioConverterBrain.cpp
#include <poly/AudioConverterBrain.h>
#include <poly/AudioDataConverter.h>
namespace poly {
AudioConverterBrain::AudioConverterBrain()
:listener(NULL)
{
}
@darkseed
darkseed / Reachability.h
Created Aug 30, 2011 — forked from dhoerl/Reachability.h
Reachability (iOS) ARCified
View Reachability.h
/*
File: Reachability.h
Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
Version: 2.2 - ARCified
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
("Apple") in consideration of your agreement to the following terms, and your
use, installation, modification or redistribution of this Apple software
@aki-null
aki-null / gist:1497649
Created Dec 19, 2011
Core Text APIを使用した際に起こる行間の問題の回避
View gist:1497649
NSFont *normalFont = [NSFont systemFontOfSize:12];
CGRect renderFrame = CGRectMake(0, 0, 300, 50); // box to render the text into
static NSLayoutManager *layMan = nil;
if (!layMan) {
layMan = [NSLayoutManager new];
}
CGFloat lineHeight = [layMan defaultLineHeightForFont:normalFont]; // calculate the expected height of a line
NSDictionary *attrDict = [NSDictionary dictionaryWithObject:normalFont andKey:NSFontAttributeName];
@geddski
geddski / nesting.js
Created Jan 14, 2012
helper function for nesting backbone collections.
View nesting.js
function nestCollection(model, attributeName, nestedCollection) {
//setup nested references
for (var i = 0; i < nestedCollection.length; i++) {
model.attributes[attributeName][i] = nestedCollection.at(i).attributes;
}
//create empty arrays if none
nestedCollection.bind('add', function (initiative) {
if (!model.get(attributeName)) {
model.attributes[attributeName] = [];
@boctor
boctor / BaseViewController.m
Created May 5, 2011
A base view controller class that when running on the simulator in debug mode, will auto simulate a memory warning every time the view controller's viewDidAppear is called
View BaseViewController.m
//
// BaseViewController.m
//
// Created by Peter Boctor on 5/4/11.
//
// Copyright (c) 2011 Peter Boctor
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
@poutyface
poutyface / gist:1223553
Created Sep 17, 2011
QEMU: 仮想ボード ARM Cortex-A9 マルチコアで Linux を動かす
View gist:1223553
モチベーション
---------------
Androidのエミュレータは中でQEMUを使ってる
中で使われているので、Android開発とは直接関係がないけど、
素のQEMUの使い方を知る。
* QEMUの使い方を覚える
* Linuxをエミュレータ環境で動かしてみる
* ARM のクロス環境に慣れてみる
@okapies
okapies / promises-are-functional.md
Last active Dec 24, 2018
翻訳: ”命令型のコールバック、関数型のプロミス: Node が逸した最大の機会” by James Coglan
View promises-are-functional.md

命令型のコールバック、関数型のプロミス: Node が逸した最大の機会

Original: "Callbacks are imperative, promises are functional: Node's biggest missed opportunity" by James Coglan

Translated by Yuta Okamoto (@okapies)

Note

  • 訳者は JavaScript や Node.js に関する専門知識がほとんどありません。識者のツッコミをお待ちしております。「◯◯が分からない」等も歓迎です。
  • 元記事から構成を一部変更しています。また、関数型プログラミングに関する記述のうち、議論の骨子に絡まないものは省略しています。
You can’t perform that action at this time.