Skip to content

Instantly share code, notes, and snippets.

View sirvon's full-sized avatar

SirVon Thomas sirvon

  • XNA Inc.
  • California, USA
View GitHub Profile
@Rhymond
Rhymond / Dockerfile
Last active July 8, 2018 16:41
Dockerize create-react-app or create-react-native-app
FROM node:latest
RUN apt-get update && \
apt-get -y install software-properties-common git-core build-essential automake unzip python-dev python-setuptools && \
rm -rf /var/lib/apt/lists/*
RUN git clone https://github.com/facebook/watchman.git /tmp/watchman
WORKDIR /tmp/watchman
RUN ./autogen.sh
RUN ./configure
@mminer
mminer / Reducer.swift
Created November 13, 2017 02:32
Example of a Redux-esque store powered by RxSwift.
typealias Reducer<StateType, ActionType> = (_ state: StateType, _ action: ActionType) -> StateType
#!/usr/bin/env python3
# Gambling Statistics Problem:
# If you play roulette every day and quit whenever you're ahead by x amount,
# do you make money in the long run?
# Answer:
# No.
import random
STARTING_BALANCE = 100000
@pietrocaselani
pietrocaselani / Example.swift
Last active January 4, 2019 03:35
Carlos + Moya + Rx
func example() -> Single<String> {
let cache = MemoryCacheLevel()
.compose(DiskCacheLevel<GithubService, NSData>())
.compose(MoyaFetcher(provider: provider))
return cache.get(GithubService.zen)
.asObservable()
.map { data -> String in
guard let string = String(data: data as Data, encoding: .utf8) else {
throw MappingError.string(data)
@loucimj
loucimj / Diffable.swift
Last active April 12, 2018 16:38
Diffable workaround for structs with IGListKit
//
// Diffable.swift
//
// Created by danielgalasko on 8/5/17.
//
import Foundation
import IGListKit
@memfis19
memfis19 / RealmManager.java
Created April 6, 2017 06:42 — forked from Zhuinden/RealmManager.java
Thread-local Realm
@Singleton
public class RealmManager {
private ThreadLocal<Realm> realms;
@Inject
public RealmManager() {
realms = new ThreadLocal<>();
}
public Realm openRealm() {
@sieyip
sieyip / README.md
Last active July 12, 2019 15:04
Installing Kafka on Mac OS X

Installing Kafka on Mac OS X

Install Homebrew

Homebrew is a great little package manager for OS X. If you haven't already, installing it is pretty easy:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@Zhuinden
Zhuinden / RealmManager.java
Last active September 22, 2017 19:20
Thread-local Realm
@Singleton
public class RealmManager {
private ThreadLocal<Realm> realms;
@Inject
public RealmManager() {
realms = new ThreadLocal<>();
}
public Realm openRealm() {

Using Swift Package Manager with iOS

Step 1:

File > New > Project...

Step 2:

Create a Package.swift file in your root project directory, add dependencies, then run swift package fetch on the command line in the same directory. We’re not going to run swift build because it will just complain.

@zwaldowski
zwaldowski / Activity.swift
Last active February 15, 2024 18:49
os_activity_t for Swift 3
//
// Activity.swift
//
// Created by Zachary Waldowski on 8/21/16.
// Copyright © 2016 Zachary Waldowski. Licensed under MIT.
//
import os.activity
private final class LegacyActivityContext {