Skip to content

Instantly share code, notes, and snippets.

View hajipy's full-sized avatar

Kenichi Saito hajipy

  • CureApp Inc.
  • Chiba, Japan
  • X @hajipy
View GitHub Profile
@hajipy
hajipy / gist:2490294
Created April 25, 2012 14:48
[NSDictionary objectForKeyWithoutNull]
@implementation NSDictionary (objectForKeyWithoutNull)
- (id)objectForKeyWithoutNull:(id)aKey
{
id value = [self objectForKey:aKey];
if ([value isEqual:[NSNull null]]) {
return nil;
}
else {
return value;
}
@hajipy
hajipy / gist:2519994
Created April 28, 2012 16:10
現在のタイムライン表示の実装
- (NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section
{
NSLog(@"TimelineDataSource#tableView:numberOfRowsInSection:(%d)", section);
NSInteger count = [[_timeline statuses] count];
return (count > 200) ? 200 : count;
}
@hajipy
hajipy / gist:5204796
Created March 20, 2013 13:51
my growthforecast chef version.1
package "build-dep" do
action :install
end
package "rrdtool" do
action :install
end
execute "cpanm" do
command "cpanm -n GrowthForecast"
execute "install rrdtool with dependencies" do
command "apt-get -y build-dep rrdtool"
action :run
end
execute "install cpanm" do
command "curl -L http://cpanmin.us | perl - App::cpanminus"
action :run
end
@hajipy
hajipy / gist:5224076
Created March 22, 2013 19:32
rbenv-chef
#
# Cookbook Name:: rbenv
# Recipe:: default
#
# Copyright 2013, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
git "/home/vagrant/.rbenv" do
@hajipy
hajipy / hikaku
Last active December 23, 2015 10:49 — forked from anonymous/hikaku
class Hikaku{
public static void main(String[] a){
int A = 2;
int B = 10;
int C = 6;
if(A>B && A>C){
if(B>C){
System.out.println("最大が"+A+"、次点が"+B);
}else{
@hajipy
hajipy / gist:6625729
Last active December 23, 2015 10:59 — forked from hiyorineko/gist:6625413
public class Baisuu{
public static void main(String[] args){
for(i=2;i=<32;i=i*2){
System.out.println(i);
}
}
}
public class Baisuu{
public static void main(String[] args){
for(i=2;i=<32;i=i*2){
System.out.println(i);
}
}
}
class maxTest {
public static void main(String args[]){
int a, b, max;
// Test 1
a = 1;
b = 2;
max = Math.max(a, b);
if (max == 2) {
System.out.println("test 1 OK");
class maxTest {
public static void main(String args[]){
test("test 1", 1, 2, 2);
test("test 2", 2, 1, 2);
test("test 3", 1, 1, 1);
}
public static void test(String name, int a, int b, int excepted) {
int max;