Skip to content

Instantly share code, notes, and snippets.

View dstd's full-sized avatar

Denis Stanishevsky dstd

View GitHub Profile
@dstd
dstd / Event.kt
Last active February 6, 2016 18:36
Plain simple events source
import java.util.*
import kotlin.Int
import kotlin.Int as ObserverId
class Event<T>() {
private val listeners: MutableMap<Int, (T) -> Unit> = HashMap();
private var nextListenerId: Int = 0
fun observe(listener: (T) -> Unit): ObserverId {
synchronized(this.listeners) {
@dstd
dstd / gist:b2192efbf9ec56b66d4b
Created December 23, 2015 07:52 — forked from mipmip/gist:1844353
Mac OS X: restart mDNSResponder
Load up Terminal (Applications > Utilities > Terminal.app) and type the following.
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
To turn it back on, just do the opposite:
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
@dstd
dstd / ViewController.swift
Created October 21, 2015 08:29 — forked from quellish/ViewController.swift
ViewController.swift
import UIKit
import CoreData
import AVFoundation
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, VPDAODelegateProtocol, NSFetchedResultsControllerDelegate {
@IBOutlet weak var segmentedControl: UISegmentedControl!
@IBOutlet weak var tableView: UITableView!
lazy var managedObjectContext : NSManagedObjectContext? = {
@dstd
dstd / inthash.md
Last active August 29, 2015 14:21 — forked from badboy/inthash.md
@dstd
dstd / SimpleRawMediaStreamSource.cs
Created April 15, 2015 17:12
With this source the MediaElement.Positions returns values
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
namespace MediaTools
{
@dstd
dstd / private.xml
Created November 30, 2014 20:02
karabiner/private.xml backup
<?xml version="1.0"?>
<root>
<item>
<name>Switch layout while holding CapsLock</name>
<appendix>F12 is implied to be configured as layout switch key</appendix>
<identifier>temp.switch.layout.by.capslock</identifier>
<autogen>__KeyToKey__ KeyCode::F19, KeyCode::VK_NONE, Option::KEYTOKEY_BEFORE_KEYDOWN, KeyCode::F12, Option::KEYTOKEY_AFTER_KEYUP, KeyCode::F12</autogen>
</item>
<item>
<name>Right Alt to switch layout</name>