Skip to content

Instantly share code, notes, and snippets.

View halsk's full-sized avatar

Hal Seki halsk

View GitHub Profile
@halsk
halsk / file2.txt
Created April 8, 2014 03:12
LocomotiveCMS + Devise を使って作ったログインページのデザインをCMS側でできるようにする(1) ref: http://qiita.com/hal_sk/items/50c45f764cb95615dd59
include Locomotive::Routing::SiteDispatcher
include Locomotive::Render
include Locomotive::ActionController::LocaleHelpers
@halsk
halsk / content_type_templates.liquid.haml
Created April 6, 2014 01:29
LocomotiveCMS でニュース記事一覧機能を作る ref: http://qiita.com/hal_sk/items/b72db4a288566e92096c
---
title: Content type templates
slug: content_type_template
listed: false
published: true
position: 100
content_type: news
---
{% extends parent %}
{% block main %}
@halsk
halsk / _form.html.haml
Created March 30, 2014 16:31
LocomotiveCMS のページにユーザー認証機能を組み込む(Engineの拡張) ref: http://qiita.com/hal_sk/items/c6d4f5582d23bc4dd415
= f.input :published, as: :'Locomotive::Toggle', input_html: { class: 'simple-toggle' }
= f.input :require_login, as: :'Locomotive::Toggle', input_html: { class: 'simple-toggle' } #この行を追加
= f.input :listed, as: :'Locomotive::Toggle', input_html: { class: 'simple-toggle' }
@halsk
halsk / bash
Created March 25, 2014 13:48
Locomotive Engine を Heroku で動かすまで ref: http://qiita.com/hal_sk/items/0512a4a9cb215fb016f5
heroku config:add HEROKU_API_KEY=<YOUR HEROKU API KEY>
heroku config:add HEROKU_APP_NAME=<YOUR APP NAME>
@halsk
halsk / GRViewController.m
Created December 8, 2013 16:47
MapBox for iOS SDK を使って、OpenStreetMap を iPhone で表示する ref: http://qiita.com/hal_sk/items/e0b3ca53303976bc0235
//
// GRViewController.m
// MapBoxSample
//
// Created by Haruyuki Seki on 12/9/13.
// Copyright (c) 2013 Georepublic. All rights reserved.
//
#import "GRViewController.h"
#import <MapBox/MapBox.h>
@halsk
halsk / default.rb
Created April 10, 2013 06:48
Vagrant up 時に、 Chef のバージョンをあげる ref: http://qiita.com/items/f22609937b9328141faf
package 'curl'
execute "Opscode Chef Client Installer for Ubuntu" do
command 'curl -L https://www.opscode.com/chef/install.sh | sudo bash'
not_if '/usr/bin/chef-client --version | /bin/grep "Chef: 11."'
end
@halsk
halsk / Singleton.m
Created April 5, 2013 05:40
Objective-C で継承可能な Singleton Class を作る ref: http://qiita.com/items/b4e51c33e7c9d29964ab
@implementation Singleton
static NSMutableDictionary *_instances;
+ (id) sharedInstance {
__block Singleton *obj;
@synchronized(self) {
if ([_instances objectForKey:NSStringFromClass(self)] == nil) {
obj = [[self alloc] initSharedInstance];
}
}
@halsk
halsk / IKGrayButton.h
Created March 28, 2013 09:23
UIButton をグラデーションにする ref: http://qiita.com/items/200cafdf1ee381453f1a
//
// IKGrayButton.h
// Ikuzo
//
// Created by Haruyuki Seki on 3/28/13.
//
#import <UIKit/UIKit.h>
@interface IKGrayButton : UIButton
@halsk
halsk / test.m
Created March 19, 2013 13:49
Kiwi で非同期テストを行う ref: http://qiita.com/items/38b66294e5c0bc46d214
SPEC_BEGIN(PropertyUtil)
describe(@"SimpleRemoteObject", ^{
context(@"read timeout", ^{
beforeAll(^{
[SRRemoteConfig defaultConfig].baseurl = @"http://localhost:2000/";
[SRRemoteConfig defaultConfig].timeout = 2;
});
it(@"should timeout with specified second", ^{
@halsk
halsk / User.h
Created March 16, 2013 15:35
サーバの JSON テキストから Objective-C のインスタンスを生成するライブラリ、SimpleRemoteObject を公開しました。 ref: http://qiita.com/items/049b9c4584769fe37896
#import <SimpleRemoteObject/SRSimpleRemoteObject.h>
@interface User : SRSimpleRemoteObject
@property(nonatomic,retain) NSString *name;
@property(nonatomic,retain) NSString *email;
@property(nonatomic) int age;
@end