Skip to content

Instantly share code, notes, and snippets.

function connectWebViewJavascriptBridge(callback) {
var rightBack = function (bridge) {
bridge.init(function (message, responseCallback) {
if (responseCallback) {
responseCallback("Right back atcha")
}
});
callback(bridge);
};
if (window.WebViewJavascriptBridge) {
@azu
azu / hoge.markdown
Created February 10, 2014 14:15 — forked from taizooo/hoge.markdown

#なんだかんだ

##えーと1 どういうこういう そういうどういう

##えーと2 どういうこういう そういうどういう

@azu
azu / webstorm.sh
Last active August 29, 2015 13:56
launch webstorm and chrome
webstorm "~/workspace/toybox/code-reading/"
if [ -n "{query}" ]; then
open -a Google\ Chrome --args "{query}"
else
open -a Google\ Chrome --args "`pbpaste`"
fi
@azu
azu / sort.m
Created February 17, 2014 03:57
countしてsort
NSDictionary *dictionary = AZ_ASTCount(
@[@"a", @"d", @"d", @"a", @"d", @"c", @"b", @"c"], ^id <NSCopying>(NSString *obj) {
return obj;
});
NSArray *orderedKeys = [dictionary keysSortedByValueUsingComparator:^NSComparisonResult(id obj1, id obj2) {
return [obj1 compare:obj2];
}];
NSLog(@"dictionary = %@", orderedKeys);
/*
dictionary = (
/*
Copyright 2012 Christopher Hoobin. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
/*
Copyright 2012 Christopher Hoobin. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
@azu
azu / AppVersioning.h
Created February 20, 2014 07:06
AppVersioningComparisonResult https://github.com/azu/AppVersioning
//
// AppVersioning.h
// AppVersioning
//
// Created by azu on 2014/02/20.
// Copyright (c) 2014 azu. All rights reserved.
//
#import <Foundation/Foundation.h>
@azu
azu / html2json.js
Created February 20, 2014 14:32
Promise.filter
var listTree = FS.listTree("../../data/", function isIndexHTML(filePath, stat) {
if (stat.isDirectory()) {
return false;
}
return path.basename(filePath) === "index.html";
}).then(function (fileList) {
var promiseMap = Promise.filter(fileList, function (filePath) {
return FS.exists(path.join(path.dirname(filePath), "index.json")).then(function(result){
return !result;
});
@azu
azu / UITabBarItem.iOS6_7.m
Created February 24, 2014 07:08
iOS6と7でUITabBarItemに選択と非選択画像をつける
- (void)setTabBarItem:(UITabBarItem *) tabBarItem tabBarItemSelectedIcon:(UIImage *) tabBarItemSelectedIcon tabBarItemUnselectedIcon:(UIImage *) tabBarItemUnselectedIcon {
BOOL isSupportRenderingType = [tabBarItemUnselectedIcon respondsToSelector:@selector(imageWithRenderingMode:)];
UIImage *selectedImage = isSupportRenderingType
? [tabBarItemSelectedIcon imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]
: tabBarItemSelectedIcon;
UIImage *unselectedImage = isSupportRenderingType
? [tabBarItemUnselectedIcon imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]
: tabBarItemUnselectedIcon;
tabBarItem.image = unselectedImage;
if ([tabBarItem respondsToSelector:@selector(selectedImage)]) {
@azu
azu / oreilly-japan.md
Last active August 29, 2015 13:56
電子書籍の販売スケジュールについての回答
  • 電子書籍の販売スケジュールについて明記されていないのは何故か?

通常の(紙の)書籍の場合、Webサイトに発売告知を行っているのは、社内で編 集作業が終わり、印刷の作業に入ったタイミングとしております。電子書籍の場 合、この条件を満たしたタイミングはリリースそのものが可能であるタイミング なので、わざわざ発売予告を行う理由がないため、そのままリリース作業を行っ ております。

  • 電子書籍の販売に書籍ごとに時間差があるのは何故か?