Skip to content

Instantly share code, notes, and snippets.

View ryokwkm's full-sized avatar

ryokwkm ryokwkm

View GitHub Profile
@ryokwkm
ryokwkm / .bashrc
Last active October 8, 2018 06:55
# Git settings
# Git bashの場合は下記2行を削除またはコメントアウトしてください。
source ./git-prompt.sh
source ./git-completion.bash
export GIT_PS1_SHOWDIRTYSTATE=1
export GIT_PS1_SHOWSTASHSTATE=1
export GIT_PS1_SHOWUNTRACKEDFILES=1
export GIT_PS1_SHOWUPSTREAM="auto"
<?php
// Here your code !
$originCode = array(3, 5, 7);
$testNumber = array( 3, 5 );
$testNumberIndex = array(0, 0);
$testNumberAnswer = array();
require 'rubygems'
require 'apns'
#APNS.host = 'gateway.sandbox.push.apple.com'
APNS.host = 'gateway.push.apple.com' # プロダクションの場合
APNS.port = 2195
APNS.pem = 'xxx_apns_test.pem'
device_token = '{取得したdevice_token}'
@ryokwkm
ryokwkm / appDelegate.swift
Last active December 17, 2015 12:03
[swift2.0] CSVデータによるCoreDataの初期化[MagicalRecord]
extension String : CollectionType{}
class AppDelegate: UIResponder, UIApplicationDelegate {
...
//DB初期データ
func setDefaultData() {
var memos:[Memo]! = Memo.MR_findAll() as! [Memo]
@ryokwkm
ryokwkm / initializeDatabaseByCsvFile.swift
Last active December 3, 2015 08:01
ファイルを読み込む
//Memoテーブルに保存。
//構造は title:String, value:String
var memos:[Memo]! = Memo.MR_findAll() as! [Memo]
if let first = memos?.first {
//データが存在した場合は初期化しない
} else {
//データ取得できなかった場合、初期データ挿入
let filePath = NSBundle.mainBundle().pathForResource("Memo", ofType: "csv")
@ryokwkm
ryokwkm / appDelegate.swift
Last active October 27, 2015 06:19
【swift】iOS 8以上対応 push通知ソース
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
//push通知の許可
if( application.respondsToSelector("registerUserNotificationSettings:")) {
// iOS8
let types:UIUserNotificationType = (.Alert | .Badge | .Sound )
let settings:UIUserNotificationSettings = UIUserNotificationSettings(forTypes: types, categories: nil)
application.registerUserNotificationSettings(settings)
@ryokwkm
ryokwkm / CommonWord.cpp
Last active August 29, 2015 14:23
ひらがなをカタカナへ変換する
//文字列を置換する
std::string CommonWord::ReplaceString( std::string String1, std::string String2, std::string String3 )
{
std::string::size_type Pos( String1.find( String2 ) );
while( Pos != std::string::npos )
{
String1.replace( Pos, String2.length(), String3 );
Pos = String1.find( String2, Pos + String3.length() );
}