Skip to content

Instantly share code, notes, and snippets.

Avatar
💻

Eneko Alonso eneko

💻
View GitHub Profile
@oleganza
oleganza / async_swift_proposal.md
Last active Sep 3, 2021
Concrete proposal for async semantics in Swift
View async_swift_proposal.md

Async semantics proposal for Swift

Modern Cocoa development involves a lot of asynchronous programming using blocks and NSOperations. A lot of APIs are exposing blocks and they are more natural to write a lot of logic, so we'll only focus on block-based APIs.

Block-based APIs are hard to use when number of operations grows and dependencies between them become more complicated. In this paper I introduce asynchronous semantics and Promise type to Swift language (borrowing ideas from design of throw-try-catch and optionals). Functions can opt-in to become async, programmer can compose complex logic involving asynchronous operations while compiler produces necessary closures to implement that logic. This proposal does not propose new runtime model, nor "actors" or "coroutines".

Table of contents

@s-aska
s-aska / Keychain.swift
Last active Aug 25, 2020
Swift Keychain class ( supported Xcode 6.0.1 )
View Keychain.swift
import UIKit
import Security
class Keychain {
class func save(key: String, data: NSData) -> Bool {
let query = [
kSecClass as String : kSecClassGenericPassword as String,
kSecAttrAccount as String : key,
kSecValueData as String : data ]
@duemunk
duemunk / Guilty
Last active Jun 23, 2016
Operator overload badge
View Guilty
<img src="http://img.shields.io/badge/Operator_overload-guilty-red.svg" height="20" alt="Uses operator overloads"/>
@rodneyrehm
rodneyrehm / gist:40e7946c0cff68a31cea
Last active Sep 4, 2021
Diagrams for Documentation
View gist:40e7946c0cff68a31cea

some tools for diagrams in software documentation

Diagrams For Documentation

Obvious Choices

ASCII

View grouper_interactor_example.rb
class GroupersController < ApplicationController::Base
def create
@grouper = Grouper.new(leader: current_member)
if @grouper.save
confirm_grouper_via_emails(@grouper)
enqueue_bar_assignment(@grouper)
redirect_to home_path
else
@davidjrice
davidjrice / .travis.yml
Last active Oct 23, 2019 — forked from johanneswuerbach/.travis.yml
Travis CI + TestFlight integration (updated for Travis' new Mac VM setup / xctool)
View .travis.yml
language: objective-c
xcode_workspace: "<WorkspaceName.xcworkspace>"
xcode_scheme: "<SchemaName>"
script: xctool -workspace <WorkspaceName.xcworkspace> -scheme <SchemeName> -configuration Release build archive
before_script:
- ./scripts/travis/add-key.sh
after_script:
- ./scripts/travis/remove-key.sh
after_success:
- ./scripts/travis/testflight.sh
@johanneswuerbach
johanneswuerbach / .travis.yml
Last active Mar 25, 2021
Deploy an iOS app to testflight using Travis CI
View .travis.yml
---
language: objective-c
before_script:
- ./scripts/travis/add-key.sh
after_script:
- ./scripts/travis/remove-key.sh
after_success:
- ./scripts/travis/testflight.sh
env:
global:
@jhjguxin
jhjguxin / creating-nested-resources-in-ruby-on-rails-3-and-updating-scaffolding-links-and-redirection.markdown
Created Jul 9, 2012
Creating nested resources in ruby on rails 3 and updating scaffolding links and redirection
View creating-nested-resources-in-ruby-on-rails-3-and-updating-scaffolding-links-and-redirection.markdown
@jobliz
jobliz / RedisPythonPubSub1.py
Created May 4, 2012
A short script exploring Redis pubsub functions in Python
View RedisPythonPubSub1.py
import redis
import threading
class Listener(threading.Thread):
def __init__(self, r, channels):
threading.Thread.__init__(self)
self.redis = r
self.pubsub = self.redis.pubsub()
self.pubsub.subscribe(channels)
@kirpit
kirpit / bash.py
Last active Jun 24, 2021
Enables to run subprocess commands in a different thread with TIMEOUT option!
View bash.py
#! /usr/bin/env python
import threading
import subprocess
import traceback
import shlex
class Command(object):
"""
Enables to run subprocess commands in a different thread with TIMEOUT option.