Skip to content

Instantly share code, notes, and snippets.

View antonve's full-sized avatar
💨
Building tadoku.app

Anton Van Eechaute antonve

💨
Building tadoku.app
View GitHub Profile
@oppoya
oppoya / gist:7ff45e0015a192cd9ed8db907c8f7507
Last active February 17, 2020 05:44
005.基本情報技術者試験
基本情報技術者
2. 2進数
・8ビット=1バイト
・転送の速度はビット単位, ファイルのサイズはバイト単位。
・Nビットなら、2のn乗でコードを表す。
・1バイを半角1文字に割り当てた文字符号(コード)がよく使われる。
・コンピュータの内部では、データを格納する入れ物のサイズ(行数)が、あらかじめ決まっている。
(4ビットだったら0010, 8ビットだったら00000010, 16ビットだったら0000000000000010)
// Profile/Profile.swift
enum Profile {}
// Timeline/Timeline.swift
enum Timeline {}
// Messaging/Messaging.swift
enum Messaging {}
// Profile/Profile.ViewController.swift
import UIKit
typealias Constraint = (UIView, UIView) -> NSLayoutConstraint
func equal<L, Axis>(_ to: KeyPath<UIView, L>, constant: CGFloat = 0, priority: UILayoutPriority? = nil) -> Constraint where L: NSLayoutAnchor<Axis> {
return equal(to, to, constant: constant, priority: priority)
}
func equal<L, Axis>(_ from: KeyPath<UIView, L>, _ to: KeyPath<UIView, L>, constant: CGFloat = 0, priority: UILayoutPriority? = nil) -> Constraint where L: NSLayoutAnchor<Axis> {
return { view1, view2 in
@AngerM
AngerM / http.go
Created October 30, 2018 03:25
High Performance Golang HTTP Client
package utils
import (
"context"
"io"
"io/ioutil"
"net"
"net/http"
"strings"
"time"

Recipes for Combining Observables in RxSwift

Several operators exist to combine multiple observables into one. This document shows the basics of the various combining operators and shows some more advanced recipes using them.

Combine Latest

The combineLatest operator is used whenever you have two or more observables emitting values, and you want access to the latest value emitted from each of them whenever one of them emits a new value. It can be used, for example, to combine a username and password to make a login request:

func example(username: Observable<String>, password: Observable<String>) {

let credentials: Observable<(String, String)> = Observable.combineLatest(username, password)

@cellularmitosis
cellularmitosis / EmojiPointersDemo.swift
Created August 15, 2018 18:11
Representing pointer values as emoji can be useful for "visually" debugging certain issues, like cell reuse, etc.
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let window = UIWindow(frame: UIScreen.main.bounds)
@pantsel
pantsel / docker-compose.yml
Last active May 13, 2024 14:29
example docker-compose.yml for kong, postgres and konga
version: "3"
networks:
kong-net:
driver: bridge
services:
#######################################
# Postgres: The database used by Kong
@doctorpangloss
doctorpangloss / repetition_algorithm.ipynb
Last active November 23, 2023 19:13
Supermemo 2 Algorithm, Unobscured (Python 3)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rongyi
rongyi / stardict2txt.py
Last active May 3, 2023 12:15
convert a stardict dictionary to txt
#!/usr/bin/python
# -*- coding: utf-8 -*-
import struct
import types
import gzip
class IfoFileException(Exception):
"""Exception while parsing the .ifo file.
Now version error in .ifo file is the only case raising this exception.