Skip to content

Instantly share code, notes, and snippets.

Seivan seivan

Block or report user

Report or block seivan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
seivan / task1.exs
Created May 11, 2017 — forked from moklett/task1.exs
Elixir Task - Crash Handling
View task1.exs
# This demonstrates that, when using async/await, a crash in the task will crash the caller
defmodule Tasker do
def good(message) do
IO.puts message
def bad(message) do
IO.puts message
raise "I'm BAD!"
seivan / bb.js
Created Dec 26, 2016 — forked from stephantabor/bb.js
Bluebird .each vs .mapSeries vs .map
View bb.js
var Promise = require('bluebird');
var funcs = Promise.resolve([500, 100, 400, 200].map((n) => makeWait(n)));
.each(iterator) // logs: 500, 100, 400, 200
.then(console.log) // logs: [ [Function], [Function], [Function], [Function] ]
.mapSeries(iterator) // logs: 500, 100, 400, 200
View Phone Words II.swift
## Phone Words
Generate a collection of words that can be represented by a given phone number. If a phone number contains the digits `1` or `0` then split up the phone number and find the words for each of the substrings as long as each substring has more than one digit. Non-keypad characters can be ignored. Optionally, filter out words so that only dictionary words are present in the result.
║ 1 ║ 2 ║ 3 ║
║ ║ abc ║ def ║
║ 4 ║ 5 ║ 6 ║
seivan / A_Promise.swift
Created Sep 25, 2016 — forked from ChristianKienle/A_Promise.swift
simplest Promise framework possible?
View A_Promise.swift
public struct Promise<T> {
typealias Fulfiller = (T) -> (Void)
typealias Rejecter = (Void) -> (Void)
typealias Resolver = (_ fulfill: @escaping Fulfiller, _ reject: @escaping Rejecter) -> (Void)
let resolver: Resolver
init(_ resolver: @escaping Resolver){
self.resolver = resolver
func then<U>(_ execute: @escaping ((T) -> U)) -> Promise<U> {
return Promise<U>({(fulfill, reject) in
seivan /
Created Aug 5, 2016 — forked from JamesMGreene/
A comparison of using `git flow` commands versus raw `git` commands.


gitflow git
git flow init git init
git commit --allow-empty -m "Initial commit"
git checkout -b develop master

Connect to the remote repository

seivan /
Created Jul 20, 2016 — forked from osteslag/
Script for managing build and version numbers using git and agvtool. See link in comments below.
# Script for managing build and version numbers using git and agvtool.
# Change log:
# v1.0 18-Jul-11 First public release.
# v1.1 29-Sep-12 Launch git, agvtool via xcrun.
version() {
seivan / firstDifferenceBetweenStrings.swift
Created Jul 7, 2016 — forked from kristopherjohnson/firstDifferenceBetweenStrings.swift
Swift code to find differences between strings and display them in a readable way, useful for displaying unit test results
View firstDifferenceBetweenStrings.swift
import Foundation
/// Find first differing character between two strings
/// :param: s1 First String
/// :param: s2 Second String
/// :returns: .DifferenceAtIndex(i) or .NoDifference
public func firstDifferenceBetweenStrings(s1: NSString, s2: NSString) -> FirstDifferenceResult {
seivan / lexer.swift
Created Jun 5, 2016 — forked from radex/lexer.swift
Wrote a little lexer/tokenizer for fun. (Warning: I have no idea what I'm doing)
View lexer.swift
import Foundation
struct Stream {
let string: NSString
var position: Int
var matchingRange: NSRange {
return NSRange(location: position, length: string.length - position)
seivan / responder-chain.swift
Created Jun 2, 2016 — forked from BurntCaramel/responder-chain.swift
Responder chain in Swift using enums
View responder-chain.swift
//: Responder chain in Swift using enums
protocol CommandProtocol {}
protocol Responder: class {
var nextResponder: Responder? { get }
func performerForCommand
<Command : CommandProtocol>
(command: Command) -> (() -> ())?
seivan / gist:0a38c293ecf9a03eaf59c9034f9c6b06
Last active May 25, 2016 — forked from alexandreraulin/gist:f4b1504aec9d25f5af08
Script for iOS Universal Framework compilation with Xcode 6
View gist:0a38c293ecf9a03eaf59c9034f9c6b06
# This script is based on Jacob Van Order's answer on apple dev forums
# See also for the start
# To get this to work with a Xcode 6 Cocoa Touch Framework, create Framework
# Then create a new Aggregate Target. Throw this script into a Build Script Phrase on the Aggregate
# Options
You can’t perform that action at this time.