Skip to content

Instantly share code, notes, and snippets.

View c-villain's full-sized avatar
🎸
🤟🏻

Alexander Kraev c-villain

🎸
🤟🏻
View GitHub Profile
@Exey
Exey / FluxSwift5_3.swift
Created June 2, 2020 18:21
Flux on Swift 5.3
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
let store = Store<Int, CounterAction>(initialState: 0) { previousState, action in
switch action {
case .increment:
return previousState + 1
case .decrement:
return previousState - 1
}
}
@oleksii-demedetskyi
oleksii-demedetskyi / ServiceLocator.swift
Last active December 12, 2020 05:04
Service locator in swift
//: Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground"
class ServiceLocator {
private var registry : [String: Any] = [:]
func registerService<T>(service: T) {
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@nateware
nateware / gist:3915757
Created October 19, 2012 01:27
Start Mac VNC server from command line
# Step 1: Set priveleges
$ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -allowAccessFor -allUsers -privs -all
Starting...
Setting allow all users to YES.
Setting all users privileges to 1073742079.
Done.
# Step 2: Allow VNC clients