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
``` | |
do { | |
try jsonData.write(toFile: url.path, atomically: true, encoding: String.Encoding.utf8) | |
} catch let error as NSError { | |
print("error:::\(error)") | |
fatalError() | |
} | |
``` |
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
/** | |
* UIStoryboard (InstantiateViewController) | |
*/ | |
UIKIT_STATIC_INLINE __kindof UIViewController *InstantiateViewControllerOnStoryboard(NSString *storyboardName, NSString *identifier) { | |
return [[UIStoryboard storyboardWithName:storyboardName bundle:nil] instantiateViewControllerWithIdentifier:identifier]; | |
} | |
UIKIT_STATIC_INLINE __kindof UIViewController *InstantiateInitialViewControllerOnStoryboard(NSString *storyboardName) { | |
return [[UIStoryboard storyboardWithName:storyboardName bundle:nil] instantiateInitialViewController]; | |
} |
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
dic = Hash.new(0) | |
while line = ARGF.gets | |
line.downcase! | |
while line.sub!(/[a-z]+/,"") | |
word = $& | |
dic[word] += 1 | |
end | |
end | |
p dic.sort{|a,b|b[1] <=> a[1]}[0...5] |
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 -X GET "https://" -O \ | |
-H "Accept:" \ | |
-H "Authorization:Bearer " |
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
var Excel = require('exceljs') | |
var fs = require('fs') | |
var util = require('util') | |
var targetExcelPath = "リスト.xlsx" | |
// ワークブック指定 | |
var workbook = new Excel.Workbook(); | |
// ファイルを読み込み |
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
Bleacon = require('bleacon'); | |
//uuidgenで生成したID(ハイフン除く)を記述する | |
var uuid = 'C6094E809AE04186A2288EC79D7DA8B0'; | |
var major = 0; | |
var minor = 0; | |
var measuredPower = -59; | |
Bleacon.startAdvertising(uuid,major,minor, | |
measuredPower); | |
console.log('ble running ....') |
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
var http = require('http') | |
var url = 'http://itunes.apple.com/jp/rss/topsongs/limit=100/xml'; | |
var rss = ''; | |
var req = http.get(url, function (res) { | |
// テキストファイルの場合は、エンコード指定は重要! | |
res.setEncoding('utf8'); |
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
// | |
// AppConst.swift | |
// AdBlockSample | |
// | |
// Created by bright on 2016/11/26. | |
// Copyright © 2016年 bright. All rights reserved. | |
// | |
import Foundation | |
import UIKit |
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
// 1. Declare outside class definition (or in its own file). | |
// 2. UIKit must be included in file where this code is added. | |
// 3. Extends UIDevice class, thus is available anywhere in app. | |
// | |
// Usage example: | |
// | |
// if UIDevice().type == .simulator { | |
// print("You're running on the simulator... boring!") | |
// } else { | |
// print("Wow! Running on a \(UIDevice().type.rawValue)") |
OlderNewer