Skip to content

Instantly share code, notes, and snippets.

View ya-s-u's full-sized avatar
🍺
Drinking

Yasuaki Goto ya-s-u

🍺
Drinking
View GitHub Profile
@lattner
lattner / async_swift_proposal.md
Last active October 30, 2025 15:46 — forked from oleganza/async_swift_proposal.md
Concrete proposal for async semantics in Swift

Async/Await for Swift

Introduction

Modern Cocoa development involves a lot of asynchronous programming using closures and completion handlers, but these APIs are hard to use. This gets particularly problematic when many asynchronous operations are used, error handling is required, or control flow between asynchronous calls gets complicated. This proposal describes a language extension to make this a lot more natural and less error prone.

This paper introduces a first class Coroutine model to Swift. Functions can opt into to being async, allowing the programmer to compose complex logic involving asynchronous operations, leaving the compiler in charge of producing the necessary closures and state machines to implement that logic.

//
// MKMapView+ZoomLevel.swift
// Monizze
//
// Created by Dylan Gyesbreghs on 23/06/2017.
// Copyright © 2017 DGyesbreghs. All rights reserved.
// https://oleb.net/blog/2010/05/set-the-zoom-level-of-mkmapview/
//
import MapKit
@ClaudeSutterlin
ClaudeSutterlin / UIImageFixedOrientationExtension.swift
Last active September 12, 2018 12:52 — forked from schickling/UIImageFixedOrientationExtension.swift
[Swift3] Extension to fix orientation of an UIImage (Sets orientation to portrait)
extension UIImage {
func fixedOrientation() -> UIImage {
if imageOrientation == .up {
return self
}
var transform: CGAffineTransform = CGAffineTransform.identity
@necojackarc
necojackarc / active_job_retry_controlable.rb
Last active June 30, 2021 13:20
To enable ActiveJob to control retry
module ActiveJobRetryControlable
extend ActiveSupport::Concern
DEFAULT_RETRY_LIMIT = 5
attr_reader :attempt_number
module ClassMethods
def retry_limit(retry_limit)
@retry_limit = retry_limit
@coa00
coa00 / file1.swift
Last active December 16, 2015 16:53
Swift2.0で正規表現を簡単に扱う。 ref: http://qiita.com/coa00@github/items/ae9c38dc92f3626dcd19
let pattern = "http://([a-zA-Z0-9]|.)+"
let str:String = "銘柄コード:1557,銘柄名:SPDR S&P500 ETF TRUST板価格:25270.0,板数量:10000にいびつな板(寄与率:81.20178%)を検出しました。http://oreore.com/servlets/Action?SRC=1234"
Regexp(pattern).isMatch(str) //マッチした結果 ここではtrue
let ret:[String] = Regexp(pattern).matches(str)! //http以下を取得
@koyhoge
koyhoge / gist:b55b331d122dcbcce28e
Last active August 29, 2015 14:20
LINE Platform Development Chronicle by TOMU TSURUHARAさん 参加メモ

LINEメッセージング基盤の進化

  • 2011年6月 LINEリリース
    • スマートフォンで使いやすいチャットを
  • 早くリリースしようということで2ヶ月程度の開発期間
@koyhoge
koyhoge / gist:4d007f60688f9b92926f
Last active August 29, 2015 14:20
LINE Messenger for the World by 池邉智洋さん
  • LINE DEVELOPER DAY_2015

  • 11:00 - 11:23

  • A-3

  • http://linedevday.linecorp.com/jp/2015/#t1s3

  • 世界中で使われているがバイナリはひとつ。運用サーバも1式

    • 各国語版はない。
    • 当初から英語リソースは用意されていた
  • 2011年末くらいから東南アジアを中心に海外ユーザが増えてきた

  • 品質の問題が顕在化

@arosh
arosh / gist:3f777066dfb0152d70c4
Last active April 9, 2017 08:25
go tutorial
package main

import (
  "fmt"
)

func main() {
  var total int = 0
  for n := 2; n <= 100; n++ {
@pxsta
pxsta / ArduinoRoomdoor.ino
Last active June 6, 2017 02:02
Arduinoで扉の開閉監視する
void setup() {
Serial.begin(9600) ;
pinMode(13, OUTPUT);
pinMode(2, INPUT_PULLUP);
}
unsigned long prev=0;
void loop() {
int x;
unsigned long current = millis();
@veeneck
veeneck / uilabeloutline.swift
Last active January 9, 2018 05:35
outline text uilabel
if let font = UIFont(name: "DamascusSemiBold", size: 24) {
let textFontAttributes = [
NSFontAttributeName : font,
// Note: SKColor.whiteColor().CGColor breaks this
NSForegroundColorAttributeName: UIColor.whiteColor(),
NSStrokeColorAttributeName: UIColor.blackColor(),
// Note: Use negative value here if you want foreground color to show
NSStrokeWidthAttributeName: -3
]