Skip to content

Instantly share code, notes, and snippets.

@keisei1092
keisei1092 / data.js
Created Feb 5, 2017
hatenablog2017-02-05a
View data.js
var $cdTitle = $('<div></div>');
$cdTitle.append($('<p></p>').text('ミライトアルマチ詩恩'));
$cdTitle.append($('<p></p>').text('keisei feat. 初音ミク'));
var $tracks = $('<div></div>');
$tracks.append($('<li class="song pointer blink" data-sound-source="yumeupload"></li>').text('ゆめアップロード'));
$tracks.append($('<li class="song pointer" data-sound-source="birthday"></li>').text('birthday'));
$tracks.append($('<li class="song pointer" data-sound-source="sakulife"></li>').text('saku*life (shion mix)'));
View UITableViewInPlayground.swift
import UIKit
import PlaygroundSupport
struct Item {
let id: Int
let name: String
}
class ViewController: UITableViewController {
let items: [Item] = [
View hatenablog-2017-01-22-16-38-32.rb
require 'sinatra'
set :port, 4568
get '/youtube-dl/:id' do
`youtube-dl -o '~/Desktop/%(title)s.%(ext)s' --add-metadata -x --audio-format mp3 'https://www.youtube.com/watch?v=#{params[:id]}'`
end
View hatenablog-2017-01-22-16-36-55.js
var target = $('.yt-lockup-meta-info');
// top
$.each(target, function() {
var videoId = $(this).closest('.yt-lockup').data('context-item-id');
var element = '<li><a href="http://localhost:4568/youtube-dl/' + videoId + '" target="_blank">mp3</a>';
$(this).append(element);
});
// show
View RxSwiftMinimalImplementation.swift
//
// ViewController.swift
// rxpractive
//
// Created by SaitoKeisei on 2016/12/19.
// Copyright © 2016 keisei_1092. All rights reserved.
//
import UIKit
import RxSwift
View noalamofire.md

NO Alamofire BUT URLSession

Alamofire、AlamofireObjectMapperおよびAlamofireImageは、依存性を増やしたり、融通がきかなくなるため使いません。
その代わりSwiftビルトインのクラスURLSessionを使います。(参考:

Examples

enum JSONError: String, ErrorType {
 case NoData = "ERROR: no data"
@keisei1092
keisei1092 / playground-snippet.swift
Last active Nov 17, 2016
PlaygroundでパッとViewだすやつ
View playground-snippet.swift
//: Playground - noun: a place where people can play
import UIKit
import PlaygroundSupport
let viewController = UIViewController()
viewController.view.backgroundColor = UIColor.white
let navigationController = UINavigationController(rootViewController: viewController)
navigationController.view.frame = CGRect(x: 0, y: 0, width: 320, height: 569)
View 同人イベント出る人スクレイピングするやつ.md

In your shell,

$ mkdir doujin-circle-scrape
$ cd doujin-circle-scrape
$ bundle init
$ emacs Gemfile

In Gemfile, add following to end