Skip to content

Instantly share code, notes, and snippets.

View yimajo's full-sized avatar
:octocat:

Yoshinori Imajo yimajo

:octocat:
  • Curiosity Software inc.
  • Tokyo, Japan
  • 14:45 (UTC +09:00)
View GitHub Profile
@koseki
koseki / bingchat-ime-fix.user.js
Last active October 16, 2023 00:29
macOS の Edge で Bing chat を使うと日本語入力確定時に勝手に送信されてしまう問題に対応する userscript
// ==UserScript==
// @name Bing Chat IME fix
// @namespace https://gist.github.com/koseki/d377f8f2e6df6655a1e160a4e03421d1
// @version 0.4
// @description macOS の Edge で Bing chat を使うと日本語入力確定時に勝手に送信されてしまう問題の対応です
// @author koseki
// @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @match https://www.bing.com/*
// @grant none
// ==/UserScript==
@wakinchan
wakinchan / generate-target-dependencies.sh
Last active February 29, 2024 13:14
Generate Target Dependencies for Package.swift
#!/usr/bin/env sh
# usage: sh ./generate-target-dependencies.sh | dot -Tsvg -o target-graph.svg
packages=`swift package describe --type json`
targets=`echo $packages | jq '.targets'`
target_names=`echo $targets | jq -r '.[] | .name'`
body=""
template=`cat <<EOF
digraph DependenciesGraph {
//------------------------------------------------------------------------
// The SwiftUI Lab: Advanced SwiftUI Animations
// https://swiftui-lab.com/swiftui-animations-part1 (Animating Paths)
// https://swiftui-lab.com/swiftui-animations-part2 (GeometryEffect)
// https://swiftui-lab.com/swiftui-animations-part3 (AnimatableModifier)
//------------------------------------------------------------------------
import SwiftUI
struct ContentView: View {
@sile
sile / rfc.md
Last active June 2, 2022 15:19
Rustの『RFC 2033: 実験的なコルーチン』の要約メモ
@CollectiveHealth-gists
CollectiveHealth-gists / rxSwiftTask.swift
Created August 8, 2017 18:50
RxSwift Download Image from Url
URLSession.shared.rx
.response(imageURL)
// subscribe on main thread
.subscribeOn(MainScheduler.sharedInstance)
.subscribe(onNext: { [weak self] data in
// Update Image
self?.imageView.image = UIImage(data: data)
}, onError: {
// Log error
}, onCompleted: {
@lattner
lattner / async_swift_proposal.md
Last active April 21, 2024 09:43 — 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.

@NinoScript
NinoScript / EnumNSCoding.swift
Last active December 2, 2019 10:47
NSCoding a Swift Enum
//: Playground - noun: a place where people can play
import Cocoa
enum Enum {
case SimpleCase
case AssociatedValue(String)
case AnotherAssociated(Int)
}
extension Enum {
@eonist
eonist / TranslucentWin.swift
Created January 27, 2016 14:09
Translucent NSWindow Example
class TranslucentWin:NSWindow, NSApplicationDelegate, NSWindowDelegate{
/**
*
*/
override init(contentRect: NSRect, styleMask aStyle: Int, backing bufferingType: NSBackingStoreType, `defer` flag: Bool) {
super.init(contentRect: Win.sizeRect, styleMask: NSTitledWindowMask|NSResizableWindowMask|NSMiniaturizableWindowMask|NSClosableWindowMask|NSFullSizeContentViewWindowMask, backing: NSBackingStoreType.Buffered, `defer`: false)
self.contentView!.wantsLayer = true;/*this can and is set in the view*/
self.backgroundColor = NSColor.greenColor().alpha(0.2)
self.opaque = false
self.makeKeyAndOrderFront(nil)//moves the window to the front
@kaiinui
kaiinui / NSURLSession の挙動.md
Last active March 7, 2017 04:38
NSURLSession の挙動

語彙

  • NSURLSession: OS の NSURLSession Daemon とのコネクションを管理するインスタンス。大体アプリにつき一つ。Singleton で OK. Delegate はこいつに紐づく。
  • NSURLSessionTask: 「リクエスト一つ」に対応。ただし OS 直属の NSURLSession Daemon に管理が委ねられる。

動き

  1. NSURLSession を初期化
@chriseidhof
chriseidhof / swift.tex
Created October 8, 2014 13:44
Listings Swift config
\lstdefinelanguage{swift}
{
morekeywords={
func,if,then,else,for,in,while,do,switch,case,default,where,break,continue,fallthrough,return,
typealias,struct,class,enum,protocol,var,func,let,get,set,willSet,didSet,inout,init,deinit,extension,
subscript,prefix,operator,infix,postfix,precedence,associativity,left,right,none,convenience,dynamic,
final,lazy,mutating,nonmutating,optional,override,required,static,unowned,safe,weak,internal,
private,public,is,as,self,unsafe,dynamicType,true,false,nil,Type,Protocol,
},
morecomment=[l]{//}, % l is for line comment