Skip to content

Instantly share code, notes, and snippets.

@uasi
uasi / MyWebViewController.m
Last active January 27, 2016 08:08
WebView からサンドボックス内のローカルファイルを読み込もうとするリクエストを書き換えるやつ
@interface MyWebViewController : NSObject
@property IBOutlet WebView *webView; // nib 内の WebView に接続済みということで
@end
@implementation MyWebViewController <WebResourceLoadDelegate>
- (void)awakeFromNib {
// WebView にデリゲートを接続
self.webView.resourceLoadDelegate = self;
}
#!/usr/bin/env perl
use 5.014;
use warnings;
use Getopt::Long;
GetOptions(
'dry-run|n' => \my $opt_dry_run,
'force|f' => \my $opt_force,
);
#!/usr/bin/env ruby
puts "1"
puts "1"
puts "1"
puts "1"
puts "1"
print "\e[3A"
print "\e[3M"
abort
@uasi
uasi / honmono.md
Last active December 10, 2015 19:38
できるだけ何も調べずに書いた。

#本物のIT技術者はこんなことを意識します へのコメント

source: http://twishort.com/An8cc

★CSSスプライト(CSS Sprite)でYSlowのリクエスト数を減らす
CSS スプライトは、複数枚の画像を1枚に統合し、 CSS で表示範囲を指定するテクニック。 HTTP リクエストの数を減らすことでページの描画速度の向上が期待できる。 YSlow は Yahoo 製のベンチマークスクリプト。リクエスト数は YSlow に限った話ではないが間違いでもない。
★関係ない外国の方は、deny fromでできるだけお帰りいただく
Apache の Deny ディレクティブ? 90年代感はあるが日本(または特定の国)に特化したサービスならなくはないか。カリフォルニア向けなら関係ないなんてつれないことは言わないほうがいいと思う。
★要らないタグをできるだけ削る
要らないなら全部削る。
@uasi
uasi / Gemfile
Created December 1, 2012 13:18
Sinatra starter kit
source :rubygems
gem 'thin'
gem 'sinatra'
gem 'sinatra-flash', require: 'sinatra/flash'
gem 'slim'
gem 'twitter'
gem 'omniauth'
gem 'omniauth-twitter'
@uasi
uasi / brew-install-version.sh
Created June 25, 2012 07:30
brew install-version (a Homebrew command that install a specific version of a formula with ease)
#!/usr/bin/env zsh
if [[ $# -lt 2 ]]; then
print -P "%UUsage%u: brew install-version [install options] FORMULA VERSION"
exit 1
fi
formula=
version=
install_opts=()
@uasi
uasi / gist:1401211
Created November 28, 2011 17:32
self.bless does not set value to public attribute
use v6;
class T {
has $!foo = 'foo';
has $.bar = 'bar';
method new($i) {
self.bless(*, foo => $i, bar => $i);
}
@uasi
uasi / install.pl
Created November 20, 2011 16:51
dotfiles installer
#!/usr/bin/perl
use 5.008;
use strict;
use warnings;
use Cwd 'realpath';
use File::Basename 'basename';
use Getopt::Long;
#!/usr/bin/env perl
use 5.014;
use warnings;
use Getopt::Long;
GetOptions(
'dry-run|n' => \my $opt_dry_run,
'force|f' => \my $opt_force,
);
@uasi
uasi / parcel-and-context.pl
Created October 20, 2011 16:56
A mystery of parcel and context in Perl 6
use v6;
sub section(|$c) { print '-- '; say($c); }
section 'WHAT is a parcel';
((1, 2), (3, 4)).WHAT.say; # Parcel()
((1, 2), (3, 4)).elems.say; # 2
section 'WHAT is a parcel-in-list-context';
list((1, 2), (3, 4)).WHAT.say; # List()