Skip to content

Instantly share code, notes, and snippets.

@kechol
kechol / NSObject.m
Created July 6, 2013 19:03
loggnig object lifecycle
- (id)init
{
self = [super init];
if (self)
{
NSLog(@"%@: %@", NSStringFromSelector(_cmd), self);
}
return self;
}
- (void)dealloc
@kechol
kechol / cocoppa.html
Created August 1, 2013 13:24
CocoPPaで生成されるHTMLを整形してみた。
<head>
<title>Instagram</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<script type="text/javascript">
if(!window.navigator.standalone) {
document.write("<link rel='stylesheet' type='text/css' href='http://cocoppa.com/css/style.css' />");
document.write("<link rel='apple-touch-icon-precomposed' href='http://d1aryq2x6mp5z6.cloudfront.net/img/icon/9/2/7/9/8/1/6c6be0bf3dfdee3d892e58d24ff3a8957b920a7d5f32bf8bb3477940dcd4e4aaed41fc0d9f01bb0ee20140e4e343ff70.png' />");
@kechol
kechol / scheme_parser.rb
Created August 24, 2013 07:48
parse URL Scheme from plists.
# coding: utf-8
require "rubygems"
require "plist"
PLIST_DIR = "./file/"
result = {}
Dir.foreach(PLIST_DIR) do |file|
path = PLIST_DIR + file
@kechol
kechol / handleopenurl_parser.rb
Created August 24, 2013 08:55
a simple script to fetch url schemes from http://handleopenurl.com/scheme.
# coding: utf-8
require "rubygems"
require "nokogiri"
require 'open-uri'
SITE_URL = "http://handleopenurl.com/scheme?page="
page = 0
last = false
result = {}
@kechol
kechol / googledocchat.js
Last active December 22, 2015 08:49
a bookmarklet to chat in public at Google Docs.
(function() {
var d = document;
d.getElementsByClassName("docs-chat-pane-container")[0].setAttribute("style", "width:100%; left:0");
d.getElementsByClassName("docs-chat-edit-container")[0].setAttribute("style", "width:100%; padding:15px; box-sizing:border-box");
d.getElementsByClassName("docs-chat-users")[0].setAttribute("style", "height:60px; overflow-y:scroll");
d.getElementsByClassName("docs-chat-edit-box")[0].setAttribute("style", "position:static; top:auto; left:auto; width:100%");
d.getElementsByClassName("docs-chat-messages")[0].setAttribute("style", "font-size:32px; line-height:1.4");
})();
// bookmarklet
@kechol
kechol / dump.sh
Last active December 23, 2015 01:09
simple mysqldump script with RDS & S3
#!/bin/sh
# required: https://github.com/aws/aws-cli
date=`date "+%Y%m%d-%H:%M:%S"`
user=<rds-user>
host=<rds-host>
db=<rds-database>
s3bucket=<s3-bucket>
@kechol
kechol / dropCsvDirective.js
Last active December 28, 2015 23:39
AngularJSでcsvをドラッグアンドドロップするdirective.
angular.module('app').directive('dropCsv', function() {
return {
scope: false,
link: function(scope, element, attrs) {
$(element).on('drop', function(e) {
e.preventDefault();
e.stopPropagation();
$(element).removeClass('drophere');
var file = e.originalEvent.dataTransfer.files[0];
@kechol
kechol / app.js
Created December 20, 2013 08:26
AnglarJSでテスト書くときの$httpの挙動確認。
'use strict';
angular.module('runtestApp', [
'ngResource',
'ngRoute',
])
.config(function ($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'views/main.html',
@kechol
kechol / fxos_bootstrap.sh
Last active January 2, 2016 10:59
firefox os build bootstrap for Ubuntu 12.04 LTS
sudo apt-get update
sudo apt-get install openjdk-6-jdk autoconf2.13 bison bzip2 ccache curl flex gawk gcc g++ g++-multilib git ia32-libs lib32ncurses5-dev lib32z1-dev libgl1-mesa-dev libx11-dev make zip
ccache --max-size 3GB
git config --global user.name User
git config --global user.email user@example.com
git config --global color.ui true
git clone git://github.com/mozilla-b2g/B2G.git
@kechol
kechol / cmd
Last active January 2, 2016 11:09
npm all packages
curl -SsL --cacert npm.crt https://registry.npmjs.org/-/all
# Other APIs
# https://registry.npmjs.org/-/all/since?stale=update_after&startkey=<unix timestamp>
# bower
# curl -SsL https://bower.herokuapp.com/packages