This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// iPadの場合にcontentのwidthを指定してやらないとdevice-width(768 or 1024)になってしまう | |
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { | |
NSString *script = [NSString stringWithFormat:@"document.querySelector('meta[name=viewport]').setAttribute('content', 'width=%d;', false); ", 320]; | |
[webView stringByEvaluatingJavaScriptFromString:script]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl 'https://api.github.com/users/questbeat/gists?page=1' | jq "." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
rew tap | sed -e "s/^/tap '/g" | sed -e "s/$/'/g" > Brewfile | |
brew list | sed -e "s/^/brew '/g" | sed -e "s/$/'/g" >> Brewfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <cmath> | |
#include <limits.h> | |
#include <string> | |
#include <sstream> | |
using namespace std; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes 2; | |
error_log /var/log/nginx/error.log; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
use epoll; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# chkconfig: - 15 15 | |
# description: Copyright (C) yosida95 All Right Reserved. | |
. /etc/rc.d/init.d/functions | |
SUPERVISORD="/usr/bin/supervisord" | |
PIDFILE="/var/run/supervisord.pid" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface UIColor (HSBFunctions) | |
- (UIColor *)lightenedColorByPercent:(CGFloat)percent; | |
- (UIColor *)darkenedColorByPercent:(CGFloat)percent; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// LaunchAtLoginController.h | |
// LaunchAtLoginController | |
// | |
// Created by Katsuma Tanaka on 2014/04/12. | |
// Copyright (c) 2014年 Katsuma Tanaka. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define NUM 8 // 製品の個数 | |
#define MAX_WEIGHT 25 // ナップサックの容量 | |
// i = 0 1 2 3 4 5 6 7 | |
int w[8] = { 3, 5, 4, 2, 10, 7, 1, 5 }; // 製品の容量 | |
int v[8] = { 3, 7, 6, 3, 13, 9, 2, 6 }; // 製品の利得 | |
// i番目以降の製品で, 容量uの制限があるときの最大利得を返す |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
// 2つの要素の大小を比較して, (ソート後の配列で)どちらを先に並べるかを返す関数 | |
int compare(const void * a, const void * b) { | |
// qsort は配列の中身が何なのか (int なのか, float なのか, それとも独自のデータ型なのか) | |
// が判らないので, とりあえず (void *) 型で渡してくる. | |
// こちらはデータの中身が int だと知っているので, ここで int に戻してあげる | |
int num1 = *(int *)a; | |
int num2 = *(int *)b; | |