Skip to content

Instantly share code, notes, and snippets.

#import <Foundation/Foundation.h>
#import "CommonCrypto/CommonDigest.h"
@interface NSString (MD5)
- (NSString *) MD5String;
@end
@implementation NSString (MD5)
@ktakayama
ktakayama / DenyRakutenNews.user.js
Last active April 7, 2024 04:58
楽天のメルマガチェックを自動解除するGreaseonkeyスクリプト
// ==UserScript==
// @name Deny Rakuten News
// @namespace http://espion.just-size.jp/archives/05/136155838.html
// @description Deny Rakuten News
// @include https://*.step.rakuten.co.jp/*
// @include https://*.travel.rakuten.co.jp/rsv/RsvInput.do*
// @include https://my.rental.rakuten.co.jp/action/my/*
// @include https://delivery.rakuten.co.jp/*?module=Default&action=OrderStep*
// @include https://auction.item.rms.rakuten.co.jp/*
// @include https://my.checkout.rakuten.co.jp/myc/purchase/Confirm
#! /usr/bin/env ruby
require 'rubygems'
require 'extexif'
require 'optparse'
def main
simulation = nil
quiet = nil
help = nil
@interface UIImage (shadow)
+ (UIImage *) imageWithContentsOfFile:(NSString *)path withShadow:(BOOL)shadow;
@end
@implementation UIImage (shadow)
+ (UIImage *) imageWithContentsOfFile:(NSString *)path withShadow:(BOOL)shadow {
UIImage *image = [UIImage imageWithContentsOfFile:path];
// ==UserScript==
// @name iTC time zone
// @namespace http://iphone-dev.g.hatena.ne.jp/ktakayama/
// @description iTC time zone
// @include https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/wo/*
// ==/UserScript==
(function() {
var path = "//div[@class='versionStateHistory-col-0']/p";
var nodes = document.evaluate(
- (UIImage *) screenImage:(UIView *)view rect:(CGRect)rect {
CGPoint pt = rect.origin;
UIImage *screenImage;
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextConcatCTM(context, CGAffineTransformMakeTranslation(-(int)pt.x, -(int)pt.y));
[view.layer renderInContext:context];
screenImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
@interface SampleView : UIView {
UIWebView *html;
}
@property (assign) UIWebView *html;
@end
@implementation SampleView
+ (BOOL) hasExt:(NSString *)ext {
NSURL *url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"check.%@", ext]];
UIDocumentInteractionController *doc =
[UIDocumentInteractionController interactionControllerWithURL:url];
BOOL success = [doc presentOptionsMenuFromRect:CGRectZero inView:[UIApplication sharedApplication].keyWindow animated:NO];
if(success) [doc dismissMenuAnimated:NO];
return success;
}
@interface NSScrollView (swipe)
- (void) scrollToTop;
- (void) scrollToBottom;
@end
static const CGFloat kSwipeGestureUp = 1.0;
static const CGFloat kSwipeGestureDown = -1.0;
@implementation NSScrollView (swipe)
@ktakayama
ktakayama / maouyusya2aozora.rb
Created November 14, 2011 07:33 — forked from tdtds/maouyusya2aozora.rb
まとめサイト上の「まおゆう」を青空文庫形式のテキストファイルに変換する
#!/usr/bin/ruby
# -*- coding: utf-8; -*-
#
require 'rubygems'
require 'open-uri'
require 'nokogiri'
puts "魔王「この我のものとなれ、勇者よ」勇者「断る!」"
puts "橙乃ままれ"
puts "\n\n"