Skip to content

Instantly share code, notes, and snippets.

View standinga's full-sized avatar

standinga

View GitHub Profile
@standinga
standinga / core.clj
Last active August 29, 2015 01:38
SC followers downloader
(ns sc.core
(:require [clj-http.client :as client]
[cheshire.core :refer :all]
[clojure.string]
[clojure.java.io :as io]))
;; !!!!!
;; FIXED version runs without problems
;; to run those functions you need enter below sound_client_id::::
(defn CHECKEDGES [G S unexpl BACKTRACK ORDERLIST] ;aux function checking all edges outgoing from vector S
(if (= (G S) [])
(if (= BACKTRACK [])
[G nil BACKTRACK ORDERLIST] ;nowhere to backtrack anymore new S is nil
(recur G (peek BACKTRACK) unexpl (pop BACKTRACK) (conj ORDERLIST S))) ;no more edges to verify, need to backtrack, add S to orderlist
; now if (G S) edges are not empty, check all vertices
(let [V (peek (G S))
newedges (pop (G S))
newG (assoc G S newedges)] ;new edges are without V anymore
package module3;
//Java utilities libraries
import java.util.ArrayList;
//import java.util.Collections;
//import java.util.Comparator;
import java.util.List;
//Processing library
import processing.core.PApplet;
//
// AppDelegate.swift
// RemoteReceiver
// Receive remote events from Bluetooth head set or player.
// Created by michal on 06/11/2018.
// Copyright © 2018 michal. All rights reserved.
//
import UIKit
import MediaPlayer
@standinga
standinga / gist:f79232adb15e1f867ad1637f47c61003
Created January 23, 2019 01:29
multiple AVAudioPlayerNode observing lastRenderTime
//
// AudioPlayer.swift
// AudioPlayerNodes
//
// Created by michal on 23/01/2019.
// Copyright © 2019 michal. All rights reserved.
//
import AVFoundation
@standinga
standinga / Fetching assets with PHFetchResult.swift
Last active February 13, 2019 00:15
IOS, Swift, Photos, gettin videos
import AVKit
import Photos
func getVideos() -> PHFetchResult<PHAsset> {
let fetchOptions = PHFetchOptions()
fetchOptions.sortDescriptors = [NSSortDescriptor(key: "creationDate",ascending: false)]
fetchOptions.predicate = NSPredicate(format: "mediaType = %d",PHAssetMediaType.video.rawValue)
return PHAsset.fetchAssets(with: fetchOptions)
}
@standinga
standinga / extensions.swift
Created February 17, 2019 10:42
NSImage to CIImage and NSImage from CIImage OSX IOS Swift 4
import Cocoa
extension NSImage {
var ciimage: CIImage? {
guard let tiffData = self.tiffRepresentation,
let bitmap = NSBitmapImageRep(data: tiffData) else {
return nil
}
return CIImage(bitmapImageRep: bitmap)
}
@standinga
standinga / heap.swift
Created April 1, 2019 12:38
Heap swift
struct Heap {
var a = [Int]()
init(_ array: [Int]) {
a = array
for i in stride(from: a.count / 2 - 1, to: 0, by: -1) {
bubbleDown(i)
}
}
@standinga
standinga / Package.swift
Created April 12, 2019 15:18
Vapor Package.swift with FluentMySQL
// swift-tools-version:4.2
import PackageDescription
let package = Package(
name: "server",
products: [
.library(name: "server", targets: ["App"]),
],
dependencies: [
.package(url: "https://github.com/vapor/vapor.git", from: "3.0.0"),
@standinga
standinga / Todo.swift
Created April 12, 2019 15:24
Vapor template update Todo.swift to use MySQL instead of SQLite
import FluentMySQL
import Vapor
final class Todo: Codable {
var id: Int?
var title: String
init(id: Int? = nil, title: String) {
self.id = id
self.title = title