Skip to content

Instantly share code, notes, and snippets.

View slightair's full-sized avatar
🍄
Hello

Tomohiro Moro slightair

🍄
Hello
View GitHub Profile
eval (%w|
puts (' Tomohi
roMo ro ,hob
by:[game,p
rogr am ming
]')| *" ")####
#### ###
@slightair
slightair / aa.rb
Last active April 24, 2022 07:26
eval (%w{ e=27 .chr
;put s("6 6663 3600
6214 5541 2600 633" .cha rs.m
ap{[ ")%# %%%% %%%# %"," )%#%
@slightair
slightair / playground.swift
Last active January 17, 2020 05:47
Apple Combine + withLatestFrom operator
let just = Just<Int>(999)
let a = [1, 2, 3, 4, 5].publisher
.withLatestFrom(just)
.sink(receiveCompletion: {
print($0)
}, receiveValue: {
print($0)
})
print()
import Foundation
protocol R {
associatedtype V
func hoge() -> V
}
struct R1: R {
typealias V = Int
@slightair
slightair / CodePiece.swift
Created January 28, 2017 06:12
寿司増やして早くした #love_swift #CodePiece
import UIKit
import PlaygroundSupport
let view = UIView(frame: CGRect(x: 0, y:0, width:320, height:44))
view.backgroundColor = UIColor.black
PlaygroundPage.current.liveView = view
(0...10).forEach {
let sushi = UILabel(frame: CGRect(x: 320, y: 0, width: 44, height: 44))
import UIKit
enum ズンドコ: UInt32 {
case ズン, ドコ
}
var list = [ズンドコ]()
while list != [.ズン, .ズン, .ズン, .ズン, .ドコ] {
let zundoko = ズンドコ(rawValue: arc4random_uniform(2))!
list.append(zundoko)
@slightair
slightair / gazoreply.user.js
Created December 4, 2013 05:57
replace gazoreply.jp copy image url
// ==UserScript==
// @name http://gazoreply.jp/
// @description replace gazoreply.jp copy image url
// @include http://gazoreply.jp/*
// @exclude http://gazoreply.jp/situation/*
// ==/UserScript==
window.addEventListener('load', function(){
var imgURL = document.getElementById("main-photo-img").getAttribute('src');
var clipboardButtonElement = document.getElementById("copy-clipboard-btn");
@slightair
slightair / gist:5748273
Created June 10, 2013 12:09
Time#to_f
[1] pry(main)> RUBY_VERSION
=> "2.0.0"
[2] pry(main)> require 'active_support/time'
=> true
[3] pry(main)> Time.new(2013, 4, 1).end_of_day
=> 2013-04-01 23:59:59 +0900
[4] pry(main)> Time.new(2013, 4, 1).end_of_day.to_f
=> 1364828400.0
[5] pry(main)> Time.at(1364828400.0)
=> 2013-04-02 00:00:00 +0900
@slightair
slightair / gist:4608690
Created January 23, 2013 16:04
dispatch_semaphore test?
#import <Foundation/Foundation.h>
#import <dispatch/dispatch.h>
int main (int argc, char const *argv[])
{
int i;
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_semaphore_t semaphore = dispatch_semaphore_create(1);
for(i = 0; i < 10; i++) {
@slightair
slightair / gist:4192942
Created December 3, 2012 05:26
ひろし
>> puts "ひろし".unpack("b*")[0].scan(/../).map{|x|%w(ヴ ィ ム …)[x.to_i(2)]}.join("")
…ヴィ…ムヴヴィィヴ…ィ…ヴィ…ィヴヴィム…ヴィ…ヴィ…ムヴヴィ…ムムィ
=> nil
>> puts ["…ヴィ…ムヴヴィィヴ…ィ…ヴィ…ィヴヴィム…ヴィ…ヴィ…ムヴヴィ…ムムィ".scan(/ヴ|ィ|ム|…/).map{|c|%w(ヴ ィ ム …).index(c)}.map{|i|"%02b"%i}.join("")].pack("b*")
ひろし
=> nil