Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View eneko's full-sized avatar
💻

Eneko Alonso eneko

💻
View GitHub Profile
@oleganza
oleganza / async_swift_proposal.md
Last active May 12, 2023 10:06
Concrete proposal for async semantics in Swift

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 September 16, 2022 03:37
Swift Keychain class ( supported Xcode 6.0.1 )
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 June 23, 2016 12:11
Operator overload badge
<img src="http://img.shields.io/badge/Operator_overload-guilty-red.svg" height="20" alt="Uses operator overloads"/>
@rodneyrehm
rodneyrehm / gist:40e7946c0cff68a31cea
Last active November 7, 2022 09:11
Diagrams for Documentation

some tools for diagrams in software documentation

Diagrams For Documentation

Obvious Choices

ASCII

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 October 23, 2019 16:17 — forked from johanneswuerbach/.travis.yml
Travis CI + TestFlight integration (updated for Travis' new Mac VM setup / xctool)
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 April 14, 2023 20:31
Deploy an iOS app to testflight using Travis CI
---
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 July 9, 2012 03:32
Creating nested resources in ruby on rails 3 and updating scaffolding links and redirection
@jobliz
jobliz / RedisPythonPubSub1.py
Created May 4, 2012 17:58
A short script exploring Redis pubsub functions in Python
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 March 17, 2023 06:29
Enables to run subprocess commands in a different thread with TIMEOUT option!
#! /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.