- ダッシュボード
- 何も考えずに各モデルをカウントするのでレコード件数増えるとえらいことになる。
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
// The following data should be run in the console while viewing the page https://read.amazon.com/ | |
// It will export a CSV file called "download" which can (and should) be renamed with a .csv extension | |
var db = openDatabase('K4W', '3', 'thedatabase', 1024 * 1024); | |
getAmazonCsv = function() { | |
// Set header for CSV export line - change this if you change the fields used | |
var csvData = "ASIN,Title,Authors,PurchaseDate\n"; | |
db.transaction(function(tx) { |
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
#ifndef NS_DESIGNATED_INITIALIZER | |
#if __has_attribute(objc_designated_initializer) | |
#define NS_DESIGNATED_INITIALIZER __attribute((objc_designated_initializer)) | |
#else | |
#define NS_DESIGNATED_INITIALIZER | |
#endif | |
#endif |
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
# 私が考える安全なプログラムを書くために必要なこと | |
今も昔も「入力によって挙動が大幅に変わるAPI」が世の中には多数存在していて、プログラマが本来意図した挙動と異なる動作を引き起こしている。 | |
- ファイルを開こうとしたらコマンドを実行できてしまったり | |
- CSSセレクタを書いてるつもりがHTMLタグを生成してしまったり | |
- SELECT文を発行するつもりがDELETE文を発行できてしまったり | |
こういったときに | |
- 入力値検証をしないと危険になる |
Greetings, NSHipsters!
As we prepare to increment our NSDateComponents -year
by 1
, it's time once again for NSHipster end-of-the-year Reader Submissions! Last year, we got some mind-blowing tips and tricks. With the release of iOS 7 & Mavericks, and a year's worth of new developments in the Objective-C ecosystem, there should be a ton of new stuff to write up for this year.
Submit your favorite piece of Objective-C trivia, framework arcana, hidden Xcode feature, or anything else you think is cool, and you could have it featured in the year-end blowout article. Just comment on this gist below!
Here are a few examples of the kind of things I'd like to see:
- Using
NSStringFromSelector(@selector())
as a safer way to do KVC / KVO / NSCoding. - Panic's [rather surprising discovery about the internals of the Lightning Digital AV Adapter](http://www.panic.com/blog/the-lightning-di
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
- (void)setupBackButtonWithSelector:(SEL)selector { | |
// create a custom button | |
LIButton *backButton = [LIButton buttonWithType:UIButtonTypeCustom]; | |
backButton.positionInNavBar = LIButtonNavPositionLeft; | |
// more back button setup | |
// add back button to navigation bar | |
UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:backButton]; | |
self.navigationItem.leftBarButtonItem = backItem; | |
} |
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
// Based on Glacier's example: http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/examples.html#Amazon_Glacier__Multi-part_Upload | |
var fs = require('fs'); | |
var AWS = require('aws-sdk'); | |
AWS.config.loadFromPath('./aws-config.json'); | |
var s3 = new AWS.S3(); | |
// File | |
var fileName = '5.pdf'; | |
var filePath = './' + fileName; | |
var fileKey = fileName; |
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
rvmを削除してrbenv+ruby-buildに変更して1.9.3-p194をビルドしましたが、Gemfileのなかの | |
gem 'turn', require: false | |
こういうハッシュでエラーが出ます。どうしたら良いでしょうか!? | |
[~/work/Rails/Gettan]$ ruby -v | |
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.2.0] | |
[~/work/Rails/Gettan]$ rbenv version | |
1.9.3-p194 (set by /Users/imaz/.rbenv/version) |
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
group :production do | |
gem "unicorn" | |
end |
NewerOlder